:root {
  --brand: #2f9e6f;
  --brand-dark: #22784f;
  --brand-soft: #e7f6ef;
  --brand-line: #d3ecdf;
  --danger: #d94848;
  --danger-soft: #fdecec;
  --warn: #d98b2b;
  --warn-soft: #fdf3e4;
  --text: #1f2933;
  --text-sub: #6b7785;
  --text-faint: #9aa4ae;
  --line: #e9edf0;
  --bg: #f4f7f6;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(31, 41, 51, .06);
  --shadow-lg: 0 8px 24px rgba(31, 41, 51, .08);
  --tab-h: 58px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page { max-width: 520px; margin: 0 auto; padding-bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); }
.page.no-tab { padding-bottom: 32px; }
.wrap { padding: 0 16px; }

/* ---------- 顶部 ---------- */
.hero {
  background: linear-gradient(150deg, #37a878 0%, #22784f 100%);
  color: #fff;
  padding: 22px 16px 46px;
  border-radius: 0 0 22px 22px;
  position: relative;
}
.hero.compact { padding-bottom: 28px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.hero h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: .3px; }
.hero .sub { font-size: 13px; opacity: .82; margin-top: 2px; }
.hero .avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .35);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600;
}
.pull-up { margin-top: -34px; position: relative; z-index: 2; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.card.tight { padding: 14px 16px; }
.card-hero { box-shadow: var(--shadow-lg); }

.section-title {
  font-size: 14px; font-weight: 600; margin: 0 0 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.section-title .left { display: flex; align-items: center; gap: 7px; }
.section-title .left::before {
  content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--brand);
}
.section-title .more { font-size: 12px; color: var(--text-faint); font-weight: 400; }

/* ---------- 状态 ---------- */
.status-top { display: flex; align-items: center; gap: 14px; }
.status-badge {
  width: 52px; height: 52px; border-radius: 16px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; background: var(--brand-soft); color: var(--brand-dark);
}
.status-badge.bad { background: var(--danger-soft); color: var(--danger); }
.status-badge.wait { background: #f1f4f6; color: var(--text-faint); }
.status-title { font-size: 17px; font-weight: 600; margin: 0; }
.status-title.bad { color: var(--danger); }
.status-desc { font-size: 13px; color: var(--text-sub); margin: 3px 0 0; }

.temp-line { display: flex; align-items: baseline; gap: 6px; margin-top: 16px; }
.temp-num { font-size: 38px; font-weight: 650; letter-spacing: -1.2px; line-height: 1; }
.temp-num.bad { color: var(--danger); }
.temp-unit { font-size: 15px; color: var(--text-sub); }
.temp-meta { margin-left: auto; text-align: right; font-size: 12px; color: var(--text-faint); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag {
  padding: 4px 11px; border-radius: 20px; font-size: 12.5px;
  background: var(--danger-soft); color: var(--danger); border: 1px solid #f3d5d5;
}
.tag.ok { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand-line); }
.tag.mute { background: #f2f4f5; color: var(--text-sub); border-color: var(--line); }

/* ---------- 快捷入口 ---------- */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-item {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow);
  padding: 14px 8px; text-align: center; text-decoration: none; color: var(--text);
  transition: transform .15s;
}
.quick-item:active { transform: scale(.97); }
.quick-item .ico { font-size: 22px; line-height: 1; }
.quick-item .t { font-size: 12.5px; margin-top: 6px; color: var(--text-sub); }

/* ---------- 列表 ---------- */
.list { margin: 0; padding: 0; list-style: none; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.li-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: 0 0 auto; }
.li-dot.bad { background: var(--danger); }
.li-main { flex: 1; min-width: 0; }
.li-title { font-size: 14px; font-weight: 500; }
.li-sub { font-size: 12px; color: var(--text-faint); margin-top: 1px; }
.li-val { font-size: 14px; font-weight: 600; color: var(--brand-dark); }
.li-val.bad { color: var(--danger); }
.li-val.mute { color: var(--text-faint); font-weight: 400; }

.kv { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; padding-bottom: 0; }
.kv:first-child { padding-top: 0; }
.kv .k { color: var(--text-sub); }
.kv .v { font-weight: 500; }

/* ---------- 图片 ---------- */
.images { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: stretch; }
.img-item {
  position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden;
  background: #f1f4f3; display: flex; align-items: center; justify-content: center;
}
.img-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 占位用绝对定位，避免内容参与尺寸计算导致三张图高度不一致 */
.img-item .ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-faint); text-align: center; padding: 6px;
}
.img-item .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 0;
  background: rgba(20, 26, 31, .42); color: #fff; font-size: 11px; text-align: center;
}

/* ---------- 按钮 ---------- */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 48px; border: none; border-radius: 12px;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 600;
  letter-spacing: .4px; text-decoration: none;
}
.btn:active { background: var(--brand-dark); }
.btn:disabled { background: #bcc8c3; }
.btn-ghost { background: #fff; color: var(--brand-dark); border: 1px solid var(--brand-line); font-weight: 500; }
.btn-sm { height: 38px; font-size: 14px; border-radius: 10px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.field input {
  width: 100%; height: 48px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px;
  font-size: 16px; color: var(--text); background: #fbfcfc;
}
.field input:focus { outline: none; border-color: var(--brand); background: #fff; }
.input-row { display: flex; gap: 10px; }
.input-row input { flex: 1; }
.btn-code {
  flex: 0 0 112px; height: 48px; border-radius: 12px;
  border: 1px solid var(--brand); background: var(--brand-soft); color: var(--brand-dark);
  font-size: 14px; font-weight: 500;
}
.btn-code:disabled { border-color: var(--line); background: #f2f4f5; color: var(--text-faint); }
.consent { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 16px; }
.consent input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand); flex: 0 0 auto; }
.consent span { font-size: 13px; color: var(--text-sub); }
.consent a { color: var(--brand-dark); }

/* ---------- 空态 / 骨架 ---------- */
.empty { text-align: center; padding: 38px 16px; color: var(--text-sub); }
.empty .big { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.empty p { margin: 6px 0 0; font-size: 12.5px; color: var(--text-faint); }
.skeleton { background: linear-gradient(90deg, #eef2f1 25%, #f6f9f8 37%, #eef2f1 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- 底部 Tab ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--text-faint); font-size: 11px;
}
.tabbar a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.tabbar a.active { color: var(--brand); }

/* ---------- 弹窗 / Toast ---------- */
.mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(20, 26, 31, .5);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.mask.show { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 520px; max-height: 84vh; background: #fff;
  border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .25s ease;
}
.mask.show .sheet { transform: translateY(0); }
.sheet-head { padding: 18px 20px 10px; font-size: 16px; font-weight: 600; border-bottom: 1px solid var(--line); }
.sheet-body { padding: 14px 20px; overflow-y: auto; font-size: 13px; color: #4a5560; line-height: 1.85; }
.sheet-body h3 { font-size: 13.5px; margin: 14px 0 4px; color: var(--text); }
.sheet-body h3:first-child { margin-top: 0; }
.sheet-foot { padding: 12px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; gap: 10px; }

.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 200; background: rgba(20, 26, 31, .88); color: #fff;
  padding: 11px 18px; border-radius: 10px; font-size: 14px; max-width: 78vw; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

.hidden { display: none !important; }
.foot-note { text-align: center; font-size: 11px; color: var(--text-faint); line-height: 1.8; margin: 6px 16px 0; }
