* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #e6eaf0;
  --text: #1c2430;
  --muted: #7a8698;
  --primary: #2b7fff;
  --ok: #12b76a;
  --warn: #f79009;
  --danger: #f04438;
  --radius: 14px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3 { font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
.muted { color: var(--muted); font-size: 13.5px; }
a { color: var(--primary); text-decoration: none; }

/* 登录页 */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-wrap { width: 100%; max-width: 400px; }
.brand { text-align: center; margin-bottom: 22px; }
.brand-mark {
  width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2b7fff, #7c5cff); color: #fff; font-weight: 700; font-size: 22px;
  box-shadow: 0 10px 24px rgba(43,127,255,.28);
}
.brand-mark.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; margin: 0; box-shadow: none; }
.brand h1 { font-size: 24px; }
.brand-sub { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: 0 16px 40px rgba(23,35,58,.06); }
.tabs { display: flex; gap: 6px; background: #f1f4f9; padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.tab { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 8px; font-size: 14.5px; color: var(--muted); cursor: pointer; }
.tab.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 2px 8px rgba(23,35,58,.06); }
form label { display: block; margin-bottom: 14px; font-size: 13.5px; color: var(--muted); }
form input {
  width: 100%; margin-top: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; background: #fbfcfe; outline: none; transition: .15s;
}
form input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(43,127,255,.12); }
.err { color: var(--danger); font-size: 13.5px; min-height: 20px; margin-bottom: 8px; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 18px; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 10px 16px; border-radius: 10px; font-size: 14.5px; cursor: pointer;
  transition: .15s; font-family: inherit;
}
.btn:hover { border-color: #cfd8e5; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #1f6fe8; }
.btn.ghost { background: #f7f9fc; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13.5px; }
.btn.danger { color: var(--danger); border-color: #ffdad6; background: #fff5f4; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* 顶部 */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 22px; }
.logo { display: flex; align-items: center; gap: 9px; font-size: 15.5px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-item { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-size: 14.5px; color: var(--muted); cursor: pointer; }
.nav-item.active { background: #eef4ff; color: var(--primary); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 10px; }
.uname { font-size: 13.5px; color: var(--muted); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 26px 20px 60px; }
.view { display: none; }
.view.active { display: block; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }

/* 账号卡片 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.acard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: .15s; }
.acard:hover { border-color: #d8e2f0; box-shadow: 0 8px 22px rgba(23,35,58,.06); }
.acard-top { display: flex; gap: 12px; align-items: center; }
.avatar { width: 46px; height: 46px; border-radius: 12px; background: #eef2f8 center/cover; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.acard-name { font-weight: 650; font-size: 15.5px; display: flex; align-items: center; gap: 7px; }
.acard-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 8px; border-radius: 999px; font-weight: 500; }
.badge.alive { background: #e8f8f0; color: #0f8f57; }
.badge.expired { background: #ffecea; color: #d02f21; }
.badge.unknown, .badge.session_only { background: #f2f4f8; color: #6b7788; }
.badge.run { background: #eef4ff; color: #2b6fd6; }
.badge.warn { background: #fff6e5; color: #b26a00; }
.aminfo { display: flex; flex-direction: column; gap: 7px; border-top: 1px dashed var(--line); padding-top: 11px; }
.aline { display: flex; justify-content: space-between; font-size: 13px; }
.aline .k { color: var(--muted); }
.abar { height: 5px; background: #eef2f8; border-radius: 999px; overflow: hidden; margin-top: 2px; }
.abar > i { display: block; height: 100%; background: linear-gradient(90deg, #2b7fff, #63b3ff); border-radius: 999px; }
.abar.low > i { background: linear-gradient(90deg, #f79009, #ffb84d); }
.abar.dead > i { background: linear-gradient(90deg, #f04438, #ff7a6e); }
.acard-actions { display: flex; gap: 8px; }
.acard-actions .btn { flex: 1; }

.empty { background: var(--card); border: 1px dashed #dfe6ef; border-radius: var(--radius); padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* 运行记录 */
.runs { display: flex; flex-direction: column; gap: 10px; }
.rrow { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; display: flex; align-items: center; gap: 14px; }
.rrow .rmain { flex: 1; min-width: 0; }
.rrow .rtitle { font-weight: 600; font-size: 14.5px; }
.rrow .rsub { color: var(--muted); font-size: 12.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 管理端 */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.panel-actions { display: flex; align-items: center; gap: 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 16px; border-bottom: 1px solid #f1f4f9; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; background: #fbfcfe; }
tr:last-child td { border-bottom: 0; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(16,24,40,.42); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 60; }
.modal.show { display: flex; }
.modal-card { background: #fff; border-radius: 18px; padding: 22px; width: 100%; max-width: 380px; box-shadow: 0 24px 60px rgba(16,24,40,.24); }
.modal-card.wide { max-width: 720px; }
.modal-card h3 { margin-bottom: 6px; }
.qr-box { margin: 16px auto; width: 220px; height: 220px; border-radius: 12px; background: #f4f7fb; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-loading { color: var(--muted); font-size: 13.5px; }
.qr-status { text-align: center; font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.qr-status.ok { color: var(--ok); font-weight: 600; }
.acts { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 18px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.check input { width: auto; margin: 0; }
.row { display: flex; gap: 10px; }
.log { background: #0f1722; color: #d7e2f0; border-radius: 12px; padding: 14px; font-size: 12.5px; line-height: 1.65; max-height: 56vh; overflow: auto; white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin: 12px 0 16px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px); background: #1c2430; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13.5px; opacity: 0; pointer-events: none; transition: .22s; z-index: 80; max-width: 84vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #b42318; }

@media (max-width: 640px) {
  .topbar-inner { gap: 10px; padding: 9px 14px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .userbox { margin-left: auto; }
  .wrap { padding: 18px 14px 50px; }
  .grid { grid-template-columns: 1fr; }
  .view-head { flex-direction: column; }
}
