:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff4ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand-badge {
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
  letter-spacing: .5px;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }

/* ---------- 布局 ---------- */
.container { max-width: 1100px; margin: 24px auto 60px; padding: 0 20px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
}
.card h2 { margin: 0 0 16px; font-size: 18px; }
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  margin-bottom: 16px;
}

/* ---------- 表单 ---------- */
label { display: block; font-size: 13px; color: #374151; font-weight: 600; margin-bottom: 10px; }
input[type="text"], input[type="password"], input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background .15s, border-color .15s;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-block { width: 100%; padding: 11px 16px; }
.btn-ghost { background: #fff; color: #374151; border-color: #d1d5db; }
.btn-ghost:hover { background: #f9fafb; }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.btn-install {
  display: block;
  width: 100%;
  padding: 14px 16px;
  font-size: 17px;
  border-radius: 12px;
  margin: 18px 0 6px;
}
.inline-form { display: inline; margin: 0; }

/* ---------- 提示条 ---------- */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: #a7f3d0; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

.app-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.app-meta { display: flex; flex-direction: column; line-height: 1.35; }
.app-meta strong { font-size: 14px; }
.app-icon {
  width: 40px; height: 40px;
  border-radius: 9px;
  object-fit: cover;
  background: #eef2f7;
  flex-shrink: 0;
}
.app-icon-fallback {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  text-transform: uppercase;
}
.mono, code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 12.5px; }
code {
  background: #f3f4f6;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  color: #374151;
  word-break: break-all;
}
code.long { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.links-cell code { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.link-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.link-row.center { justify-content: center; }
.share-link { display: inline-block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.ops-cell { white-space: nowrap; }
.ops-cell .btn, .ops-cell form { margin-right: 6px; }
.count-badge {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 700;
  margin-left: 6px;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty-tip { padding: 14px 0; }
.center { text-align: center; }

/* ---------- 登录页 ---------- */
.auth-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #eff6ff 0%, #f5f7fa 60%);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 34px 30px;
  margin: 20px;
}
.auth-card h1 { font-size: 20px; margin: 14px 0 4px; }
.auth-logo {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
  letter-spacing: .5px;
}
.auth-card form { margin-top: 18px; }
.auth-card label { margin-bottom: 14px; }
.auth-card .btn { margin-top: 6px; }

/* ---------- 安装页 ---------- */
.install-bg {
  min-height: 100vh;
  background: #eef2f7;
  padding: 20px 14px 48px;
}
.install-card {
  max-width: 460px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 26px 22px;
}
.app-head { text-align: center; }
.app-head h1 { font-size: 22px; margin: 12px 0 8px; }
.app-icon-lg {
  width: 92px; height: 92px;
  border-radius: 20px;
  object-fit: cover;
  background: #eef2f7;
  box-shadow: 0 2px 8px rgba(16, 24, 40, .12);
  margin: 0 auto;
}
.app-icon-fallback.app-icon-lg { font-size: 36px; }
.chips { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.chip {
  background: #f3f4f6;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
  color: #374151;
}
.qr-block { text-align: center; margin: 22px 0 6px; }
.qr-img {
  width: 180px; height: 180px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 6px;
}
.steps, .links { margin-top: 22px; }
.steps h3, .links h3 { font-size: 15px; margin: 0 0 10px; }
.steps ol { padding-left: 20px; margin: 0; font-size: 14px; }
.steps li { margin-bottom: 8px; }
.links .link-row span { width: 70px; flex-shrink: 0; font-size: 13px; color: var(--muted); }
.foot { text-align: center; margin-top: 20px; }

/* ---------- 二维码弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal.hidden { display: none; }
.modal-card {
  position: relative;
  background: var(--card);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.modal-card h3 { margin: 0 0 12px; font-size: 17px; }
.modal-card img { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; }
.modal-close {
  position: absolute;
  top: 10px; right: 12px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .grid2 { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; }
  .container { padding: 0 12px; }
  .card { padding: 16px; }
}
