/* 2FA 重登服务共享 UI 样式 */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e5e9f2;
  --line-strong: #d6dce8;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --teal: #0d9488;
  --danger: #e11d48;
  --ok: #059669;
  --warn: #d97706;
  --info: #0284c7;
  --ring: 0 0 0 4px rgba(37, 99, 235, .14);
  --shadow: 0 18px 44px -26px rgba(15, 23, 42, .35);
  --shadow-sm: 0 8px 20px -16px rgba(15, 23, 42, .3);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(900px 500px at 8% -8%, rgba(37, 99, 235, .10), transparent 60%),
    radial-gradient(800px 480px at 100% 0%, rgba(13, 148, 136, .10), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px 72px; }
.wrap.narrow { max-width: 900px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1120px; margin: 0 auto; padding: 14px 20px;
  backdrop-filter: blur(14px);
  background: rgba(244, 246, 251, .82);
  border-bottom: 1px solid rgba(229, 233, 242, .8);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; flex: 0 0 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  color: #fff; font-size: 12px; font-weight: 800; letter-spacing: -.4px;
  background: linear-gradient(135deg, #2563eb, #0d9488);
  box-shadow: 0 8px 18px -10px rgba(37, 99, 235, .7);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .1px; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav a, .nav button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 999px;
  color: var(--muted); background: transparent; border: 1px solid transparent;
  font-size: 13px; text-decoration: none;
}
.nav a:hover, .nav button:hover { color: var(--text); background: rgba(255, 255, 255, .8); border-color: var(--line); text-decoration: none; }
.nav a.active, .nav button.active {
  color: var(--primary); background: #fff; border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.page-head { padding: 38px 0 22px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--teal); font-size: 11px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
h1 { margin-top: 8px; font-size: clamp(26px, 3.2vw, 34px); line-height: 1.18; letter-spacing: -.8px; }
.subtitle { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.7; max-width: 720px; }
.page-head .hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.hero-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .8); border: 1px solid var(--line);
  color: var(--muted); font-size: 12px; white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(5,150,105,.12); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card.flat { box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.card-desc { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin-top: 4px; }
.section-kicker { font-size: 11px; font-weight: 700; color: var(--muted-2); letter-spacing: .12em; text-transform: uppercase; }

.tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 16px;
}
.tabs button {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 15px; border-radius: 9px; font-size: 13px; font-weight: 600;
}
.tabs button:hover { color: var(--text); }
.tabs button.active {
  background: #fff; color: var(--primary);
  box-shadow: 0 5px 14px -8px rgba(15, 23, 42, .45);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 9px 16px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: #fff; color: var(--text); font-size: 13px; font-weight: 600;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 10px 20px -12px rgba(37, 99, 235, .8);
}
.btn-primary:hover { background: linear-gradient(135deg, #1d4ed8, #1e40af); }
.btn-teal {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, #0d9488, #0f766e);
  box-shadow: 0 10px 20px -12px rgba(13, 148, 136, .8);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--danger); border-color: #fecdd3; background: #fff1f2; }
.btn-sm { min-height: 32px; padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.link {
  border: 0; background: none; color: var(--primary);
  font-size: 12.5px; font-weight: 600; padding: 2px 4px;
}
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.stack { display: grid; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

.field { display: grid; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px;
  background: #fff; color: var(--text); padding: 10px 12px; font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #93b4f9; box-shadow: var(--ring); }
textarea { min-height: 168px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.65; }
textarea.compact { min-height: 112px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.7; }
.hint code, .code {
  background: #eef2f7; border: 1px solid #e2e8f0; border-radius: 5px;
  padding: 1px 5px; color: #334155; font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.example {
  background: #0f172a; color: #cbd5e1; border-radius: 10px;
  padding: 11px 13px; font-size: 12px; line-height: 1.65;
  overflow-x: auto; white-space: pre; margin-top: 10px;
}
.msg { min-height: 20px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }
.msg.warn { color: var(--warn); }
.notice {
  padding: 11px 13px; border-radius: 10px; font-size: 12.5px; line-height: 1.65;
  background: #eff6ff; border: 1px solid #dbeafe; color: #1e40af;
}
.notice.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat {
  position: relative; overflow: hidden;
  padding: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(180deg, #fff, #fbfcff);
}
.stat::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--line-strong);
}
.stat .num { font-size: 24px; font-weight: 800; letter-spacing: -.6px; line-height: 1.15; }
.stat .label { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.stat.pending::before { background: #38bdf8; } .stat.pending .num { color: var(--info); }
.stat.running::before { background: #f59e0b; } .stat.running .num { color: var(--warn); }
.stat.success::before { background: #10b981; } .stat.success .num { color: var(--ok); }
.stat.failed::before { background: #fb7185; } .stat.failed .num { color: var(--danger); }
.stat.canceled::before { background: #94a3b8; } .stat.canceled .num { color: var(--muted); }
.stat.neutral::before { background: #818cf8; }

.progress { display: flex; align-items: center; gap: 12px; margin: 16px 0 4px; }
.progress-track { flex: 1; height: 8px; border-radius: 999px; background: #edf1f7; overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #2563eb, #0d9488); transition: width .35s ease; }
.progress-text { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.batch-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.batch-id {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px; border-radius: 8px; background: var(--surface-2);
  border: 1px dashed var(--line-strong); color: var(--muted);
  font-family: ui-monospace, Menlo, monospace; font-size: 11.5px;
}
.copy-btn {
  border: 0; background: transparent; color: var(--primary);
  font-size: 11.5px; font-weight: 700; padding: 0 2px;
}

.table-wrap {
  width: 100%; overflow-x: auto;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid #eef2f7; vertical-align: top; }
th {
  background: var(--surface-2); color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8fbff; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.pending { background: #e0f2fe; color: #0369a1; }
.badge.running { background: #fef3c7; color: #b45309; }
.badge.success, .badge.alive { background: #dcfce7; color: #047857; }
.badge.failed, .badge.dead { background: #ffe4e6; color: #be123c; }
.badge.canceled, .badge.unknown { background: #f1f5f9; color: #64748b; }
.errtext { color: #be123c; max-width: 380px; overflow-wrap: anywhere; font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; word-break: break-all; }
.muted { color: var(--muted); }
.strong { font-weight: 700; }

.modal-mask {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(5px);
}
.modal {
  width: min(760px, 100%); max-height: 82vh; overflow: auto;
  background: #fff; border-radius: 18px; padding: 20px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.55);
  animation: pop .18s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-title { font-size: 15px; font-weight: 700; }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
pre.log {
  margin: 0; padding: 14px; border-radius: 12px;
  background: #0b1220; color: #cbd5e1; font-size: 11.8px; line-height: 1.7;
  overflow: auto; max-height: 56vh; white-space: pre-wrap; word-break: break-word;
}

.hidden { display: none !important; }
.footer {
  padding: 24px 0 0; text-align: center; color: var(--muted-2);
  font-size: 11.5px; line-height: 1.7;
}

/* 管理后台 */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 100%); padding: 26px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.captcha {
  width: 100%; height: 62px; object-fit: contain;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--surface-2);
}
.admin-head { padding: 30px 0 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.admin-head h1 { font-size: 26px; }
.switch-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text); }
.switch-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.proxy-progress { font-size: 12px; color: var(--muted); }

/* 使用说明 */
.guide-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: start; }
.guide-layout > * { min-width: 0; }
.toc {
  position: sticky; top: 86px;
  background: rgba(255,255,255,.75); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; backdrop-filter: blur(10px);
  min-width: 0;
}
.toc-title { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); padding: 4px 8px 8px; }
.toc a { display: block; padding: 7px 9px; border-radius: 8px; color: var(--muted); font-size: 12.5px; }
.toc a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.guide-section { scroll-margin-top: 92px; }
.guide-section h2 { font-size: 19px; letter-spacing: -.3px; margin-bottom: 10px; }
.guide-section h3 { font-size: 14px; margin: 16px 0 7px; }
.guide-section p, .guide-section li { font-size: 13px; line-height: 1.8; color: #334155; }
.guide-section ul, .guide-section ol { padding-left: 20px; margin: 7px 0; }
.guide-section pre { margin: 10px 0; }
.rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rule-card { border: 1px solid var(--line); border-radius: 12px; padding: 13px; background: var(--surface-2); }
.rule-card strong { display: block; font-size: 12.5px; margin-bottom: 5px; }
.rule-card span { color: var(--muted); font-size: 12px; line-height: 1.6; }

@media (max-width: 900px) {
  .stat-grid, .stat-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
  .toc-title { width: 100%; }
  .page-head .hero-row { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 14px 56px; }
  .topbar { padding: 11px 14px; flex-wrap: wrap; }
  .brand-name { font-size: 14px; }
  .card { padding: 17px; border-radius: 15px; }
  .stat-grid, .stat-grid.five, .grid-2, .grid-3, .grid-4, .settings-grid, .rule-grid { grid-template-columns: 1fr; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 8px 10px; }
  .admin-head { flex-direction: column; align-items: flex-start; }
  th, td { padding: 9px 10px; }
  .modal { padding: 16px; border-radius: 15px; }
}
