:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --border: #e3e8ee;
  --text: #1f2933;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --ok: #16a34a;
  --warn: #d97706;
  --fail: #dc2626;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 18px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.username { color: var(--muted); }

.container { max-width: 1080px; margin: 0 auto; padding: 24px 16px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.toolbar h2 { margin: 0; font-size: 20px; }

/* 按钮 */
.btn {
  border: 1px solid transparent; border-radius: 8px; padding: 8px 14px;
  font-size: 14px; cursor: pointer; background: #eef2f6; color: var(--text);
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.danger { background: #fef2f2; color: var(--fail); border-color: #fecaca; }
.icon-btn { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 平台分组 */
.platforms { display: grid; gap: 20px; }
.platform-group { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.platform-group h3 { margin: 0 0 12px; font-size: 16px; }
.account-list { display: grid; gap: 12px; }

.account-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.account-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.account-name { font-weight: 600; }
.account-meta { color: var(--muted); font-size: 13px; }
.account-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.badge { font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.badge.ok { background: #ecfdf5; color: var(--ok); }
.badge.expired, .badge.fail { background: #fef2f2; color: var(--fail); }
.badge.unknown { background: #f1f5f9; color: var(--muted); }
.badge.running, .badge.login_ok, .badge.done { background: #eff6ff; color: var(--primary); }

/* 表单 */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: #fff; color: var(--text);
}
label.inline { display: flex; align-items: center; gap: 8px; color: var(--text); }
label.inline input { width: auto; }
.pwd-wrap { display: flex; align-items: center; gap: 6px; }
.pwd-wrap input { flex: 1; }
.pwd-toggle { width: auto; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: #f1f5f9; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; }
.msg { font-size: 13px; margin-top: 8px; min-height: 18px; }
.msg.error { color: var(--fail); }
.msg.ok { color: var(--ok); }

/* 弹窗 */
.modal-mask, .drawer-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 20;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.drawer-mask { justify-content: flex-end; }
#otp-mask { z-index: 30; }
.hidden { display: none !important; }
.footer {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 16px; padding: 18px 16px 24px; font-size: 12px; color: var(--muted);
}
.footer a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--text); }
.beian-icon { width: 16px; height: 16px; }
.modal {
  background: var(--card); border-radius: var(--radius); width: 100%; max-width: 460px;
  max-height: 90vh; overflow: auto;
}
.modal-head, .drawer-head {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3, .drawer-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* 抽屉 */
.drawer {
  background: var(--card); width: 100%; max-width: 440px; height: 100%;
  display: flex; flex-direction: column;
}
.qr-box { padding: 16px 18px; border-bottom: 1px solid var(--border); text-align: center; }
.qr-box img { max-width: 240px; max-height: 240px; border-radius: 8px; }
.log-list { flex: 1; overflow: auto; padding: 12px 18px; display: flex; flex-direction: column; gap: 8px; }
.log-item { font-size: 13px; line-height: 1.5; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
.log-item .ts { color: var(--muted); margin-right: 6px; }
.log-item.success { color: var(--ok); }
.log-item.fail { color: var(--fail); }
.log-item.warn { color: var(--warn); }
.log-item.info { color: var(--text); }

/* 登录页 */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 380px; padding: 28px;
}
.auth-card h1 { margin: 0 0 6px; font-size: 22px; text-align: center; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab { flex: 1; padding: 8px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tip { color: var(--muted); font-size: 12px; margin-top: 16px; }
.auth-card .btn.primary { width: 100%; margin-top: 14px; }

/* 弹窗内扫码登录 */
#btn-modal-login { width: 100%; margin: 12px 0; }
.login-loading { display: flex; align-items: center; gap: 10px; margin: 12px 0; color: var(--muted); font-size: 13px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .account-head { flex-direction: column; align-items: flex-start; }
}
