:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #1677ff;
  --primary-hover: #0958d9;
  --danger-bg: #fef2f2;
  --danger-text: #b91c1c;
  --danger-border: #fecaca;
  --ok-bg: #ecfdf5;
  --ok-text: #047857;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  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.5;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

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

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

.client-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--muted);
}

.client-banner strong {
  color: var(--text);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #f3f4f6;
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.tab {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.panel.is-hidden { display: none; }

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

.alert-error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.wx-qr-box {
  min-height: 310px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fafbfc;
}

.wx-qr-loading {
  color: var(--muted);
  font-size: 13px;
}

.hint {
  margin: 12px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.hint-secondary {
  margin: 6px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.hint-secondary a {
  color: var(--primary);
  text-decoration: none;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.field input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

.code-row {
  display: flex;
  gap: 8px;
}

.code-row input { flex: 1; }

.btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border-color: #d1d5db;
}

.btn-secondary:hover:not(:disabled) {
  background: #f9fafb;
}

.btn-block { width: 100%; }

.bind-header, .profile-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-lg { width: 52px; height: 52px; }

.avatar-fallback {
  background: #e0edff;
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.heading {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.desc {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.info-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 18px;
  overflow: hidden;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child { border-bottom: 0; }
.info-label { color: var(--muted); }
.info-value { font-weight: 500; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #f3f4f6;
  color: var(--muted);
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.empty-box, .error-box {
  padding: 16px;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid var(--border);
  text-align: center;
}

.error-box .btn { margin-top: 14px; }

.footer {
  margin-top: 20px;
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
