/* ==========================================================================
   上海财神庙 · 义工服务 H5（T001）— 全局样式（壳 + 公共组件）
   规则：这里只放「全站共用」的东西；某一屏自己的样式写在 modules/*.js 里，
        并且必须以该模块 id 当前缀（.m-home .xxx）。
   版本：?v=20261109-t007
   ========================================================================== */

:root {
  --cream: #FBF8F1;      /* 宣纸暖米底 */
  --paper: #FFFDF7;      /* 卡片 / 顶栏 */
  --gold: #9F7835;       /* 暗金 */
  --gold-2: #C9A25E;     /* 描边金 */
  --gold-3: #E6D8BC;     /* 浅金线 */
  --gold-4: #F4EBD8;     /* 金色底纹 */
  --purple: #800080;     /* 品牌紫（只作点缀） */
  --ink: #2B2B2B;
  --ink-2: #5B5348;
  --soft: #8C7B5E;
  --line: #EADFC8;
  --danger: #C0392B;
  --serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif SC", "SimSun", serif;
  --safe: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; touch-action: manipulation; }

body {
  background: #EFE7D8;
  color: var(--ink);
  font: 14px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  overflow-x: clip;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.app {
  position: relative;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--cream);
  overflow-x: clip;
}

#view { min-height: calc(100vh - 52px); }

/* ---------- 壳：顶栏 ---------- */
.shell-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  height: 52px;
  padding: 0 6px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.shell-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.shell-back svg { width: 20px; height: 20px; }
.shell-bar h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 壳：底部 Tab（数量由注册表决定） ---------- */
.shell-tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 40;
  display: grid;
  width: 100%;
  max-width: 480px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe);
}
.shell-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 5px;
  border: 0;
  background: none;
  color: #6E6A62;
  cursor: pointer;
}
.shell-tab svg { width: 23px; height: 23px; }
.shell-tab span { font-size: 12px; line-height: 1.3; white-space: nowrap; }
.shell-tab.on { color: var(--purple); }

/* 底部栏全站常驻：页面容器统一留出「栏高 56px＋安全区」，最后一行不被压住 */
.has-tabs #view { padding-bottom: calc(56px + var(--safe)); }

/* ---------- 壳：toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe));
  z-index: 100;
  max-width: 80%;
  padding: 11px 18px;
  border-radius: 8px;
  background: rgba(43, 43, 43, .92);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity .18s ease, transform .18s ease;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 公共：页容器 ---------- */
.page { padding: 16px 0 30px; }

/* ---------- 公共：按钮 ---------- */
.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 25px;
  background: linear-gradient(180deg, #DAB674, #C0973F);
  box-shadow: 0 4px 12px rgba(159, 120, 53, 0.26);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
}
.btn-gold:disabled {
  background: #DCD3C2;
  box-shadow: none;
  color: #fff;
  cursor: not-allowed;
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 22px;
  border: 1px solid var(--gold-3);
  border-radius: 24px;
  background: var(--paper);
  color: var(--gold);
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
}
.btn-block { display: flex; width: 100%; }

/* ---------- 公共：筛选 chips ---------- */
.chips {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px;
  overflow-x: auto;
}
.chip {
  flex: none;
  padding: 6px 14px;
  border: 1px solid var(--gold-3);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
}
.chip.on {
  border-color: var(--gold-2);
  background: var(--gold-4);
  color: var(--gold);
  font-weight: 600;
}

/* ---------- 公共：活动卡 ---------- */
.act-list { display: grid; gap: 12px; }
.act-card {
  position: relative;
  padding: 13px 14px 12px;
  background: var(--paper);
  border: 1.5px solid var(--gold-2);
  border-radius: 16px;
  box-shadow: 0 3px 10px rgba(159, 120, 53, 0.10);
  cursor: pointer;
}
.act-card::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(201, 162, 94, 0.42);
  border-radius: 12px;
  pointer-events: none;
}
.act-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gold-3);
}
.act-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--ink);
}
.chev { display: flex; color: var(--gold-2); }
.chev svg { width: 16px; height: 16px; }
.act-time {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0 9px;
}
.act-when { display: flex; flex-direction: column; gap: 2px; }
.act-when .d { font-size: 15px; font-weight: 600; color: var(--ink); }
.act-when .t2 { font-size: 14px; color: var(--soft); letter-spacing: .5px; }
.act-time .t { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: .5px; }
.act-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--gold-3);
}
.seats { font-size: 14px; color: var(--ink-2); }
.seats b { color: var(--gold); font-weight: 600; }
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  height: 34px;
  padding: 0 16px;
  border-radius: 17px;
  background: linear-gradient(180deg, #DAB674, #C0973F);
  box-shadow: 0 2px 6px rgba(159, 120, 53, 0.28);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
}
.pill.off { background: #D9D1C1; box-shadow: none; color: #fff; }

/* ---------- 公共：键值表 / 段落块 / 空状态 / 状态标签 ---------- */
.kv {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px 10px;
  margin: 12px 16px 0;
  padding: 14px;
  border: 1px solid var(--gold-3);
  border-radius: 14px;
  background: var(--paper);
}
.kv dt { font-size: 14px; color: var(--soft); }
.kv dd { margin: 0; font-size: 14px; color: var(--ink); word-break: break-all; }

.section {
  margin: 12px 16px 0;
  padding: 13px 14px;
  border: 1px solid var(--gold-3);
  border-radius: 14px;
  background: var(--paper);
}
.section h4 {
  margin: 0 0 5px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--gold);
}
.section p { margin: 0; font-size: 14px; line-height: 1.85; color: var(--ink-2); }

.empty {
  margin: 30px 16px;
  padding: 26px 16px;
  border: 1px dashed var(--gold-3);
  border-radius: 14px;
  text-align: center;
  color: var(--soft);
  font-size: 14px;
}

.status {
  flex: none;
  padding: 2px 8px;
  border: 1px solid currentColor;
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.45;
  white-space: nowrap;
}
.status[data-s="待审核"] { color: var(--gold); background: rgba(159, 120, 53, .08); }
.status[data-s="已通过"] { color: var(--purple); background: rgba(128, 0, 128, .06); }
.status[data-s="已结束"] { color: #8C8C8C; background: rgba(140, 140, 140, .08); }
.status[data-s="已驳回"] { color: var(--danger); background: rgba(192, 57, 43, .07); }
.status[data-s="日期待确认"] { color: #B4761E; background: rgba(180, 118, 30, .10); }
.status[data-s="活动已取消"] { color: #8C8C8C; background: rgba(140, 140, 140, .10); }

/* ---------- 公共：报名记录卡 ---------- */
.rec-card {
  margin: 0 16px 12px;
  padding: 13px 14px;
  border: 1px solid var(--gold-3);
  border-radius: 16px;
  background: var(--paper);
}
.rec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gold-3);
}
.rec-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--ink);
}
.rec-line { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }

/* ---------- 公共：表单 ---------- */
.form-card {
  margin: 0 16px;
  padding: 6px 14px 18px;
  border: 1px solid var(--gold-3);
  border-radius: 16px;
  background: var(--paper);
}
.form-row { display: block; padding-top: 12px; }
.form-row .lab {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
  color: var(--soft);
  letter-spacing: .5px;
}
.form-row .lab em { color: var(--danger); font-style: normal; margin-left: 2px; }
.form-row input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
}
.form-row input:focus { border-color: var(--gold-2); }
.form-row input::placeholder { color: #B7AB95; }
.err { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--danger); }
.err:empty { display: none; }
.agree-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 0 4px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
  cursor: pointer;
}
.agree-line input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--gold); }
.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--gold);
  font-family: inherit;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}
.form-card .btn-gold { margin-top: 16px; }

/* ---------- 公共：底部固定操作条 ---------- */
.cta {
  position: fixed;
  left: 50%;
  bottom: calc(56px + var(--safe));
  transform: translateX(-50%);
  z-index: 40;
  width: 100%;
  max-width: 480px;
  padding: 10px 16px;
  background: var(--paper);
  border-top: 1px solid var(--line);
}
