:root {
  --brand: #12694a;
  --brand-soft: #e8f4ee;
  --text: #1f2329;
  --weak: #8a9099;
  --line: #ebedf0;
  --warn: #d8622f;
  --radius: 14px;
}

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

/* 元素自身的 display 会盖过 hidden 属性的 UA 默认样式，这里强制兜底 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: #f4f5f7;
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

h2, h3 { margin: 0 0 10px; font-size: 17px; }
h2 { font-size: 19px; }
p { margin: 0 0 8px; }

.muted { color: var(--weak); font-size: 13px; }
.center { text-align: center; }
.link { color: var(--brand); cursor: pointer; font-size: 14px; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--brand); color: #fff;
  padding-top: calc(14px + env(safe-area-inset-top));
}
.topbar-title { font-weight: 600; }
.topbar-action { font-size: 14px; opacity: .85; cursor: pointer; }

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

.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
  margin: 12px 16px;
}

.intro { background: var(--brand-soft); }
.intro h2 { color: var(--brand); }
.intro p { font-size: 14px; margin: 0; }

/* 表单 */
.field { margin-bottom: 12px; }
.field input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; /* 小于 16px 时 iOS 会自动放大页面 */
  background: #fafbfc; color: var(--text);
}
.field input:focus { outline: none; border-color: var(--brand); background: #fff; }

.field-code { display: flex; gap: 10px; }
.field-code input { flex: 1; }

.btn {
  display: block; width: 100%;
  padding: 13px; border: none; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 16px;
  cursor: pointer;
}
.btn:disabled { background: #c3ccc7; cursor: not-allowed; }
.btn-wechat { background: #07c160; }

.btn-ghost {
  padding: 0 16px; white-space: nowrap;
  border: 1px solid var(--brand); border-radius: 10px;
  background: #fff; color: var(--brand); font-size: 14px; cursor: pointer;
}
.btn-ghost:disabled { border-color: var(--line); color: var(--weak); cursor: not-allowed; }

/* 通知渠道 */
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.switch-row span { display: flex; flex-direction: column; }
.switch-row em { font-style: normal; margin-top: 2px; }

.switch { position: relative; width: 46px; height: 26px; appearance: none; cursor: pointer; }
.switch::before {
  content: ""; position: absolute; inset: 0;
  background: #d8dce0; border-radius: 999px; transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; background: #fff; border-radius: 50%;
  transition: transform .2s;
}
.switch:checked::before { background: var(--brand); }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { cursor: not-allowed; opacity: .5; }

.hint {
  margin-top: 12px; padding: 12px;
  background: #fdf4ec; border-radius: 10px;
  font-size: 13px; color: #8a5a34;
}
#qrcode-box { margin-top: 10px; text-align: center; }
#qrcode-box img { width: 160px; height: 160px; border-radius: 8px; }

/* 监控列表 */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 16px 4px;
}
.section-head h3 { margin: 0; font-size: 14px; color: var(--weak); font-weight: 400; }

.sub-head { display: flex; align-items: center; justify-content: space-between; }
.sub-date { font-size: 17px; font-weight: 600; }
.sub-desc { margin: 8px 0 0; }
.sub-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 13px;
}

.tag { font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.tag-live { background: var(--brand-soft); color: var(--brand); }
.tag-wait { background: #fdf0e6; color: var(--warn); }
.tag-done { background: #eef0f2; color: var(--weak); }

.empty { text-align: center; padding: 32px 18px; }
.empty p { color: var(--weak); }

/* 弹层 */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 86vh; overflow-y: auto;
  background: #fff; border-radius: 18px 18px 0 0; padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-tip { margin-bottom: 12px; }

.day-list { border-top: 1px solid var(--line); }
.day {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 2px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.day-label { font-size: 15px; }
.day-hint { font-size: 12px; color: var(--weak); margin-top: 3px; }
.hint-free { color: var(--brand); }
.hint-full { color: var(--warn); }
.day-off { cursor: not-allowed; }
.day-off .day-label, .day-off .day-hint { color: #c2c7cc; }
.day-on .day-label { color: var(--brand); font-weight: 600; }
.check { color: var(--brand); font-size: 18px; }

.sheet-foot { padding-top: 16px; }
.threshold { display: block; margin-bottom: 14px; font-size: 14px; color: var(--weak); }
.threshold input {
  width: 64px; padding: 6px 8px; margin: 0 4px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
}

/* 反馈 */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%);
  z-index: 100; max-width: 80%;
  padding: 11px 18px; border-radius: 10px;
  background: rgba(0, 0, 0, .82); color: #fff; font-size: 14px;
}
.loading { position: fixed; inset: 0; z-index: 90; background: rgba(255, 255, 255, .4); }
.loading span {
  position: absolute; top: 50%; left: 50%; width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid var(--brand-soft); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-color-scheme: dark) {
  :root { --text: #e6e8eb; --weak: #8f959e; --line: #2b2f36; --brand-soft: #14332a; }
  body { background: #16181c; }
  .card { background: #21242a; }
  .field input { background: #1a1d22; color: var(--text); }
  .field input:focus { background: #21242a; }
  .btn-ghost { background: transparent; }
  .hint { background: #33281c; color: #d9a877; }
  .sheet-body { background: #21242a; }
}
