/* IP 中转控制台 · 浅色后台 UI（独立样式，不依赖站点 style.css） */
:root {
  --bg: #f0f2f5;
  --sidebar: #f9f6ee;
  --sidebar-border: #efe7da;
  --card: #ffffff;
  --text: #1f2329;
  --text-dim: #6b7280;
  --text-faint: #9ca3af;
  --border: #e6e8eb;
  --border-strong: #d7dae0;
  --brand: #ff8822;
  --brand-hover: #ea7410;
  --blue: #1677ff;
  --blue-hover: #4096ff;
  --blue-soft: #e8f1ff;
  --green: #16a34a;
  --green-soft: #e7f8ee;
  --yellow: #d97706;
  --yellow-soft: #fef3e2;
  --red: #dc2626;
  --red-soft: #fee9e7;
  --blue-state: #2563eb;
  --blue-state-soft: #e8f1ff;
  --gray-soft: #f0f1f3;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
svg { display: block; }

.app-shell { min-height: 100vh; }

/* ============ 左侧侧边栏 ============ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  padding: 14px 10px 12px;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 0 8px 12px; border-bottom: 1px solid var(--sidebar-border); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #ff8822, #ffb020);
  color: #fff; font-size: 14px; font-weight: 800;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 15px; font-weight: 800; }
.brand-text small { margin-top: 2px; color: var(--text-dim); font-size: 11px; font-weight: 500; }

.menu { display: flex; flex-direction: column; gap: 3px; margin-top: 12px; }
.menu-item {
  display: flex; align-items: center; gap: 9px;
  min-height: 36px; padding: 7px 11px; border-radius: 7px;
  color: #3d4451; font-size: 13px; font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}
.menu-item svg { width: 17px; height: 17px; flex: none; opacity: 0.9; }
.menu-item:hover { background: rgba(255, 136, 34, 0.08); }
.menu-item.active { background: var(--brand); color: #fff; }
.menu-item.active:hover { background: var(--brand-hover); }

.sidebar-foot {
  margin-top: auto; padding: 8px 10px 2px;
  display: flex; align-items: center; gap: 7px;
  color: var(--text-faint); font-size: 11.5px;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14); }

/* ============ 主内容区 ============ */
.main { margin-left: 232px; padding: 14px 16px 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.title-wrap h1 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: 0.2px; }
.title-wrap p { margin: 3px 0 0; color: var(--text-dim); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border: 1px solid transparent; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); }
.btn-ghost { background: #fff; border-color: var(--border-strong); color: #3d4451; }
.btn-ghost:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.btn-danger { background: #fff; border-color: #f3c1bd; color: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red-soft); border-color: var(--red); }
.btn-mini { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; }

/* ============ 统计卡片 ============ */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.stat-label { color: var(--text-dim); font-size: 12px; font-weight: 600; }
.stat-value { margin-top: 6px; font-size: 22px; font-weight: 800; line-height: 1; letter-spacing: 0.2px; }
.stat-sub { margin-top: 4px; color: var(--text-faint); font-size: 11.5px; }

/* ============ 面板 ============ */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin-top: 12px; }
.panel-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel-title-row h2 { margin: 0; font-size: 13.5px; font-weight: 700; }
.panel-title-row p { margin: 2px 0 0; color: var(--text-faint); font-size: 11.5px; }

/* ============ 筛选栏 ============ */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 136px; }
.field-grow { flex: 1 1 200px; min-width: 180px; }
.field-label { color: var(--text-dim); font-size: 11.5px; font-weight: 600; }
.control {
  height: 32px; padding: 0 30px 0 10px; border: 1px solid var(--border-strong); border-radius: 7px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center / 13px;
  appearance: none; -webkit-appearance: none; font-size: 12.5px; color: var(--text); width: 100%;
}
input.control { padding-right: 10px; }
.control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12); }
.control::placeholder { color: var(--text-faint); }
.filter-actions { display: flex; align-items: center; gap: 8px; }

/* ============ 表格 ============ */
.table-panel { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 1180px; }
.data-table th, .data-table td { padding: 8px 10px; text-align: left; vertical-align: middle; }
.data-table thead th {
  background: #fafafa; color: var(--text-dim); font-size: 11.5px; font-weight: 700;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table tbody tr { border-bottom: 1px solid #f0f2f5; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table td { font-size: 12.5px; color: var(--text); }
.col-check { width: 40px; }
.col-actions { width: 260px; }
.data-table input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--blue); cursor: pointer; }
.cell-strong { font-weight: 600; }
.cell-sub { color: var(--text-faint); font-size: 11.5px; margin-top: 2px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-running { color: var(--green); background: var(--green-soft); }
.badge-pending { color: var(--yellow); background: var(--yellow-soft); }
.badge-deploying { color: var(--blue-state); background: var(--blue-state-soft); }
.badge-failed { color: var(--red); background: var(--red-soft); }
.badge-released { color: var(--text-dim); background: var(--gray-soft); }

.link-box { display: flex; align-items: center; gap: 6px; }
.link-mask { color: var(--text-dim); font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  width: 26px; height: 26px; flex: none; display: inline-grid; place-items: center;
  border: 1px solid var(--border-strong); border-radius: 6px; background: #fff; color: var(--text-dim);
}
.icon-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.icon-btn svg { width: 13px; height: 13px; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.text-link { color: var(--blue); font-size: 11.5px; font-weight: 600; background: none; border: none; padding: 0; }
.text-link:hover { color: var(--blue-hover); text-decoration: underline; }

/* ============ 空态 / 加载 / 分页 ============ */
.empty { padding: 40px 20px; text-align: center; color: var(--text-dim); }
.empty-icon { width: 46px; height: 46px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 50%; background: var(--gray-soft); color: var(--text-faint); }
.empty-icon svg { width: 22px; height: 22px; }
.empty-title { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--text); }
.empty-note { margin: 5px auto 0; max-width: 520px; font-size: 12px; color: var(--text-faint); line-height: 1.6; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 20px; color: var(--text-dim); font-size: 12.5px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #d9dde3; border-top-color: var(--blue); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--border); }
.footer-meta { color: var(--text-dim); font-size: 12px; }
.pagination { display: flex; align-items: center; gap: 5px; }
.page-btn {
  min-width: 28px; height: 28px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: #fff; color: var(--text-dim); font-size: 12px; font-weight: 600;
}
.page-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.page-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============ 弹窗 / Toast ============ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(15, 23, 42, 0.42); padding: 20px;
}
.modal { width: min(430px, 100%); background: #fff; border-radius: 10px; box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.modal-close { width: 26px; height: 26px; border: none; background: transparent; color: var(--text-faint); font-size: 19px; line-height: 1; border-radius: 6px; }
.modal-close:hover { background: var(--gray-soft); color: var(--text); }
.modal-body { padding: 14px 16px; font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  min-width: 220px; max-width: 340px; padding: 9px 12px; border-radius: 8px;
  background: #fff; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  border-left: 3px solid var(--blue); font-size: 12.5px; color: var(--text);
  animation: toast-in 0.18s ease;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--blue); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.qr-box { width: 182px; height: 182px; margin: 0 auto; background: #fff; border: 8px solid #fff; outline: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.qr-box svg, .qr-box img { width: 100%; height: 100%; display: block; }
.qr-empty { border-style: dashed; outline: 1px dashed var(--border-strong); }
.qr-empty span { padding: 0 12px; text-align: center; font-size: 12px; color: var(--text-faint); line-height: 1.6; }

/* ================= 身份区（侧栏） ================= */
.identity {
  margin-top: auto;
  padding: 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.identity-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.identity-label { color: var(--text-dim); font-size: 11px; font-weight: 600; }
.identity-value {
  max-width: 138px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text); font-size: 12px; font-weight: 700;
}
.linklike { border: none; background: none; padding: 0; color: var(--blue); font-weight: 700; }
.linklike:hover { text-decoration: underline; }
.sidebar-foot { margin-top: 8px; }
.pulse-idle { background: #cbd5e1; box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.16); }

/* ================= 顶栏 / 提示条 ================= */
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.notice {
  margin-top: 12px; padding: 9px 12px; border-radius: 8px;
  background: var(--blue-soft); border: 1px solid #cfe2ff; color: #1e3a8a;
  font-size: 12px; line-height: 1.6;
}
.notice b { margin-right: 8px; }
.notice .text-link { margin-left: 6px; color: #1d4ed8; }

/* ================= 概览 chip ================= */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; background: #fff;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text-dim); font-size: 12px; font-weight: 600;
}
.chip b { color: var(--text); font-size: 13px; font-weight: 800; }
.chip-ok { color: var(--green); background: var(--green-soft); border-color: #c7edd6; }
.chip-ok b { color: var(--green); }
.chip-warn { color: var(--yellow); background: var(--yellow-soft); border-color: #f6ddb8; }
.chip-warn b { color: var(--yellow); }
.chip-xs { padding: 1px 7px; font-size: 11px; gap: 4px; box-shadow: none; }

/* ================= 钱包 / 概览数据条 ================= */
.wallet-bar {
  display: flex; flex-wrap: wrap; align-items: stretch;
  margin-top: 12px; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.wb-item { display: flex; flex-direction: column; gap: 1px; padding: 8px 16px; min-width: 0; }
.wb-item + .wb-item { border-left: 1px solid var(--border); }
.wb-label { color: var(--text-dim); font-size: 11px; font-weight: 600; }
.wb-value { color: var(--text); font-size: 17px; font-weight: 800; line-height: 1.25; }
.wb-value-sm { font-size: 12.5px; font-weight: 600; color: #3d4451; }
.wb-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; padding: 8px 14px; border-left: 1px solid var(--border); }

/* ================= 面板内小件 ================= */
.inline-empty {
  padding: 18px 14px; border-radius: 8px; background: #fafbfc;
  border: 1px dashed var(--border-strong); color: var(--text-dim);
  font-size: 12px; line-height: 1.7; text-align: center;
}
.inline-hint {
  padding: 8px 11px; border-radius: 7px; background: var(--gray-soft);
  color: var(--text-dim); font-size: 12px; line-height: 1.6;
}

/* ================= 表格补充 ================= */
.row-picked { background: var(--blue-soft); }
.data-table tbody tr.row-picked:hover { background: #dde9ff; }
.cell-err {
  margin-top: 2px; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--red); font-size: 11.5px;
}
.text-ok { color: var(--green); font-weight: 700; }
.text-err { color: var(--red); font-weight: 700; }

/* ================= 表单 ================= */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-field { min-width: 0; }
.form-field.span2 { grid-column: 1 / -1; }
.form-grid textarea.control { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; line-height: 1.6; }
.field-hint { color: var(--text-faint); font-size: 11px; line-height: 1.5; }
.check-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--text-dim); font-size: 12px; cursor: pointer; }
.check-line input[type="checkbox"] { width: 14px; height: 14px; flex: none; accent-color: var(--blue); }
.modal.wide { width: min(760px, 100%); }
.modal.wide .modal-body { max-height: 74vh; overflow-y: auto; }
.modal-text { margin: 0; color: var(--text-dim); font-size: 12.5px; line-height: 1.7; }
.modal-body .mono { color: var(--text); }
.kv-list { margin: 0; display: grid; gap: 6px; padding: 10px; border-radius: 8px; background: #fafbfc; border: 1px solid var(--border); }
.qr-box + .kv-list { margin-top: 12px; }
.kv-list > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.kv-list dt { color: var(--text-faint); font-size: 11.5px; }
.kv-list dd { margin: 0; color: var(--text); font-size: 12.5px; font-weight: 600; }

/* ================= 页头：四个页面各自的强调色 ================= */
.page-head { display: flex; align-items: center; gap: 11px; min-width: 0; }
.page-head-icon { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.page-head-icon svg { width: 19px; height: 19px; }
.accent-blue { background: var(--blue); }
.accent-teal { background: #0d9488; }
.accent-indigo { background: #6366f1; }
.accent-orange { background: var(--brand); }

/* ================= 进度条 / 探测详情 ================= */
.loadbar { height: 6px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; }
.loadbar i { display: block; height: 100%; border-radius: 999px; background: var(--blue); }
.loadbar-high i { background: var(--yellow); }
.loadbar-full i { background: var(--red); }
.probe-detail {
  margin: 10px 0 0; padding: 8px 10px; border-radius: 7px;
  background: #f7f8fa; border: 1px solid var(--border); color: var(--text-dim);
  font-family: ui-monospace, Consolas, monospace; font-size: 11px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all; max-height: 180px; overflow: auto;
}

/* ================= 代理页（选购 / 我的代理） ================= */
.tabs { display: flex; gap: 6px; margin-top: 12px; border-bottom: 1px solid var(--border); }
.tab {
  display: inline-flex; align-items: center; border: none; background: none;
  padding: 9px 14px; margin-bottom: -1px; color: var(--text-dim); font-size: 13px; font-weight: 600;
  border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0;
}
.tab:hover { color: var(--text); background: rgba(22, 119, 255, 0.06); }
.tab.on { color: var(--text); font-weight: 700; border-bottom-color: var(--brand); }
.tab .tag {
  margin-left: 6px; padding: 1px 6px; border-radius: 4px;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
}

.linkcell { display: flex; align-items: center; gap: 5px; }
.linkcell .txt { font-size: 11.5px; color: var(--text); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sw {
  position: relative; display: inline-block; vertical-align: middle;
  width: 34px; height: 19px; padding: 0; border: none; border-radius: 999px; background: #d1d5db;
}
.sw::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.sw.on { background: var(--green); }
.sw.on::after { left: 17px; }

.qrgrid { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.qr-card { width: 196px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; text-align: center; }
.qr-card .t { font-size: 12.5px; font-weight: 700; color: var(--text); }
.qr-card .qr-box { width: 150px; height: 150px; margin: 8px auto; }
.qr-card .sub { margin-bottom: 8px; color: var(--text-dim); font-size: 11.5px; word-break: break-all; }
.toolpanel { flex: 1; min-width: 320px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.toolrow { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-bottom: 1px solid #f0f2f5; }
.toolrow:last-child { border-bottom: none; }
.toolrow .nm { width: 96px; flex: none; color: var(--text); font-size: 12.5px; font-weight: 600; }
.toolrow .lnk {
  flex: 1; min-width: 0; color: var(--text-faint);
  font-family: ui-monospace, Consolas, monospace; font-size: 11.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toolrow .btn { flex: none; }
.hint { margin-top: 12px; color: var(--text-faint); font-size: 12px; line-height: 1.7; }

/* ================= 响应式 ================= */
@media (max-width: 1080px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
}
