:root {
  --bg: #f3f4f6;
  --card: #fff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --green: #0a7d32;
  --green-soft: #ecfdf5;
  --red: #b42318;
  --field: #f9fafb;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  padding: 0 0 86px;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

main { max-width: 560px; margin: 0 auto; padding: 12px 14px 24px; }

/* ---------- 顶栏 ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto; padding: 12px 16px;
  background: rgba(243, 244, 246, .92);
  backdrop-filter: saturate(180%) blur(10px);
}
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.logo {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--green); color: #fff; font-size: 14px; font-weight: 700;
}
.logo.big { width: 52px; height: 52px; border-radius: 16px; font-size: 24px; margin: 0 auto 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #12b76a; box-shadow: 0 0 0 4px #d1fadf; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card.pad0 { padding: 0; overflow: hidden; }
.card h2 { font-size: 15px; margin: 0 0 4px; }
.card.error { border-color: #fecdca; background: #fffbfa; color: var(--red); }
.card.warn { border-color: #fedf89; background: #fffcf5; color: #93370d; font-size: 13px; }
.card.ok-box { background: var(--green-soft); border-color: #a6f4c5; color: #05603a; font-size: 13px; }
.card.link { display: block; text-align: center; color: var(--red); text-decoration: none; font-size: 14px; }
.card a { color: inherit; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 12px; font-weight: 600; color: #4b5563; margin: 14px 0 6px; }
input, select {
  width: 100%; padding: 11px 12px; font-size: 15px; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: 10px;
  outline: none; appearance: none;
}
input:focus, select:focus { border-color: var(--green); background: #fff; }
input[type="checkbox"], input[type="radio"] {
  -webkit-appearance: auto;
  appearance: auto;
  width: 20px;
  height: 20px;
  min-width: 20px;
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
  border-radius: 0;
  accent-color: var(--green);
  flex: 0 0 auto;
  cursor: pointer;
}
select { background-image: linear-gradient(45deg, transparent 50%, #9ca3af 50%), linear-gradient(135deg, #9ca3af 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }

.stock {
  background: var(--green-soft); border: 1px solid #a6f4c5; color: #05603a;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 6px;
}
.stock b { font-weight: 700; }
.stock span { display: block; color: #067647; opacity: .8; font-size: 12px; margin-top: 2px; }

/* ---------- 按钮 ---------- */
.btn {
  display: block; width: 100%; margin-top: 16px; padding: 13px;
  background: var(--green); color: #fff; border: 0; border-radius: 12px;
  font-size: 15px; font-weight: 700; text-align: center; text-decoration: none;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.btn.ghost.danger { color: var(--red); }
.btn.ghost + .btn.ghost { margin-top: 8px; }
.mini {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 4px 10px; font-size: 12px; color: var(--green); cursor: pointer;
}

/* ---------- diff 表 ---------- */
table.diff { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.diff tr + tr { border-top: 1px solid #f3f4f6; }
table.diff td { padding: 10px 12px; vertical-align: top; }
table.diff .obj { color: var(--muted); width: 34%; }
table.diff .obj span { display: block; color: #9ca3af; font-size: 11px; }
table.diff .from { color: #9ca3af; text-decoration: line-through; word-break: break-all; }
table.diff .arrow { color: #d1d5db; width: 12px; text-align: center; padding: 10px 2px; }
table.diff .to { color: var(--green); font-weight: 600; word-break: break-all; }

table.plain { width: 100%; border-collapse: collapse; font-size: 13px; }
table.plain th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 10px 14px; border-bottom: 1px solid #f3f4f6; }
table.plain td { padding: 10px 14px; border-bottom: 1px solid #f6f7f8; vertical-align: top; }
table.plain tr:last-child td { border-bottom: 0; }
table.kv td:first-child { color: var(--muted); width: 40%; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* ---------- 步骤 ---------- */
.steps { list-style: none; padding: 0; margin: 0 0 12px; }
.steps li { display: flex; gap: 10px; padding: 10px 4px; border-bottom: 1px solid #f3f4f6; }
.steps li:last-child { border-bottom: 0; }
.tick {
  flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--green); color: #fff; display: grid; place-items: center;
  font-size: 11px; margin-top: 1px;
}
.steps b { display: block; font-size: 13.5px; }
.steps span { font-size: 12.5px; color: var(--muted); word-break: break-all; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 18px 0 10px; }
.ok-circle {
  width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--green-soft); color: var(--green);
  display: grid; place-items: center; font-size: 34px;
}
.hero h2 { margin: 0; font-size: 19px; }
.hero p { margin: 4px 0 0; font-size: 12.5px; }

/* ---------- 站点列表 ---------- */
.site {
  display: flex; justify-content: space-between; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; margin-bottom: 8px; text-decoration: none; color: inherit;
}
.site b { display: block; font-size: 14px; }
.site span { font-size: 12px; color: var(--muted); }
.site .right { text-align: right; }
.site em { display: block; font-style: normal; font-size: 11px; color: #9ca3af; margin-top: 2px; }

/* ---------- 其它 ---------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; background: #f3f4f6; color: var(--muted);
}
.badge.ok { background: var(--green-soft); color: #067647; }
.badge.bad { background: #fef3f2; color: #b42318; }
.plain .old { color: #9ca3af; text-decoration: line-through; }
.plain .new { color: var(--green); font-weight: 600; }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost.danger { background: #fff; color: var(--red); border-color: #fecdca; }
textarea {
  width: 100%; padding: 11px 12px; font-size: 13px; line-height: 1.6; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: 10px;
  outline: none; resize: vertical; font-family: inherit;
}
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; padding: 8px 8px; border-bottom: 1px solid #f3f4f6; }
table.tbl td { padding: 8px; border-bottom: 1px solid #f6f7f8; vertical-align: middle; }
table.tbl td b { display: block; font-size: 12.5px; word-break: break-all; }
table.tbl .sub { display: block; color: #9ca3af; font-size: 10.5px; }
table.tbl select, table.tbl input { padding: 6px 8px; font-size: 12px; border-radius: 8px; }
table.tbl select { padding-right: 24px; background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px; }
table.tbl td:nth-child(1) { width: 34%; }
table.tbl td:nth-child(3) { width: 132px; }
.namelist { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.9; }
.namelist li { word-break: break-all; }
.ok-text { color: var(--green); }
.danger-box {
  margin-top: 12px; padding: 12px; border-radius: 10px;
  background: #fffbfa; border: 1px solid #fecdca; color: #912018; font-size: 13px;
}
.danger-box b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.danger-box p { margin: 0 0 10px; color: #b42318; }
.danger-box label { margin: 0 0 6px; color: #912018; font-size: 12px; }
.danger-box input { background: #fff; border-color: #fda29b; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap { gap: 8px; }
.row.gap .btn { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
pre {
  margin: 10px 0 0; padding: 12px; border-radius: 10px;
  background: #f9fafb; border: 1px solid var(--line);
  font: 12px/1.7 ui-monospace, Consolas, monospace;
  white-space: pre-wrap; word-break: break-all; color: #374151;
  max-height: none; overflow: visible;
  user-select: text; -webkit-user-select: text;
  -webkit-touch-callout: default;
}
code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.chk { display: flex; gap: 10px; align-items: center; font-size: 13px; color: #93370d; background: #fffcf5; border: 1px solid #fedf89; border-radius: 8px; padding: 12px; margin-top: 12px; cursor: pointer; }
.chk input { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.kpis div { background: #f9fafb; border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.kpis b { display: block; font-size: 18px; }
.kpis span { font-size: 11px; color: var(--muted); }

/* ---------- 登录 ---------- */
body.center { display: grid; place-items: center; min-height: 100vh; padding: 0; }
.login { width: min(340px, 88vw); text-align: center; }
.login h1 { font-size: 18px; margin: 0 0 2px; }
.login .muted { margin: 0 0 14px; font-size: 12px; }
.login input { margin-bottom: 10px; }
.err { color: var(--red); font-size: 12px; min-height: 16px; margin: 8px 0 0; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-around;
  max-width: 560px; margin: 0 auto;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(8px);
}
.nav { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: #9ca3af; font-size: 11px; padding: 2px 16px; }
.nav i { font-style: normal; font-size: 17px; line-height: 1; }
.nav.on { color: var(--green); font-weight: 600; }
