/* ============================================================
 * 康平小程序 v2 · H5 样式
 * 适老化硬性：默认 18px / 三档 18/20/24 全局 / 按钮触达 88rpx、极简 128rpx / 高对比
 * 375px 基准：1rpx = 0.5px（88rpx = 44px，128rpx = 64px）
 * ============================================================ */
:root {
  /* 字号档位（body[data-fs] 切换，1=18 / 2=20 / 3=24） */
  --fs: 18px;
  --fs-title: 20px;
  --fs-big: 24px;
  --fs-small: 15px;
  --touch: 44px;        /* 88rpx 最小触达区 */
  --touch-lg: 64px;     /* 128rpx 极简触达区 */
  --radius: 12px;
  --color-primary: #c8102e;   /* 党建红 */
  --color-primary-dark: #a00d25;
  --color-grid: #1f5aa5;      /* 网格蓝 */
  --color-gov: #1f8a4c;       /* 政务绿 */
  --color-life: #e8890c;      /* 便民橙 */
  --color-elder: #e6a800;     /* 适老黄 */
  --color-bg: #f4f5f7;
  --color-card: #ffffff;
  --color-text: #1a1a1a;      /* 高对比深色文字 */
  --color-text-2: #4d4d4d;
  --color-text-3: #737373;
  --color-line: #e5e6e8;
  --color-warn: #d93025;
  --color-ok: #1f8a4c;
  --shadow: 0 1px 4px rgba(0,0,0,.06);
}
/* 三档字号全局生效 */
body[data-fs="1"] { --fs: 18px; --fs-title: 20px; --fs-big: 22px; --fs-small: 15px; }
body[data-fs="2"] { --fs: 20px; --fs-title: 22px; --fs-big: 25px; --fs-small: 16px; }
body[data-fs="3"] { --fs: 24px; --fs-title: 27px; --fs-big: 30px; --fs-small: 20px; }
/* 极简模式：字号 24 + 触达 128rpx */
body.elder-mode { --fs: 24px; --fs-title: 27px; --fs-big: 30px; --fs-small: 20px; --touch: 64px; --touch-lg: 72px; }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: var(--fs);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  max-width: 480px;
  margin: 0 auto;
}
button { font-family: inherit; font-size: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: var(--color-text); }

/* ---------- 布局 ---------- */
.app { min-height: 100%; padding-bottom: 68px; }
.view { display: none; }
.view.active { display: block; }
.page-body { padding: 12px; }

/* 顶部导航 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--color-primary);
  color: #fff; padding: 10px 12px;
}
.topbar-hd { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 8px; flex: 1; }
.logo-icon { width: 34px; height: 34px; border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-name { font-size: var(--fs-title); font-weight: 700; }
.topbar-actions { display: flex; gap: 6px; }
.tb-btn { color: #fff; width: var(--touch); height: var(--touch); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.tb-btn:active { background: rgba(255,255,255,.18); }
.tb-btn svg { width: 24px; height: 24px; }

.sub-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  background: var(--color-primary); color: #fff; padding: 10px 8px;
}
.sub-header .back { color: #fff; width: var(--touch); height: var(--touch); font-size: var(--fs-big); font-weight: 700; border-radius: 8px; }
.sub-header .sub-title { flex: 1; text-align: center; font-size: var(--fs-title); font-weight: 700; }
.sub-header .sub-action { color: #fff; width: var(--touch); height: var(--touch); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.sub-header .sub-action svg { width: 24px; height: 24px; }

/* 底部 5 Tab */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 480px; z-index: 30;
  background: #fff; border-top: 1px solid var(--color-line);
  display: flex; box-shadow: 0 -2px 8px rgba(0,0,0,.05);
}
.tab-item {
  flex: 1; min-height: var(--touch-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--color-text-3); gap: 2px;
}
.tab-item .tab-ico { font-size: 22px; line-height: 1; }
.tab-item .tab-txt { font-size: 13px; }
body[data-fs="3"] .tab-item .tab-txt, body.elder-mode .tab-item .tab-txt { font-size: 15px; }
.tab-item.active { color: var(--color-primary); font-weight: 700; }
.tab-item.hidden-tab { display: none; }

/* ---------- 卡片 / 区块 ---------- */
.card { background: var(--color-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.section-hd { display: flex; align-items: center; justify-content: space-between; margin: 16px 4px 10px; font-size: var(--fs-title); font-weight: 700; }
.section-hd .more { font-size: var(--fs-small); color: var(--color-text-3); font-weight: 400; }
.muted { color: var(--color-text-3); }
.empty { color: var(--color-text-3); text-align: center; padding: 28px 0; font-size: var(--fs); }
.loading { color: var(--color-text-3); text-align: center; padding: 24px 0; }

/* ---------- 适老化入口 ---------- */
.elder-entry {
  background: linear-gradient(135deg, #ffe9a8, #f7d15e);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 12px;
}
.elder-entry .ee-icon { font-size: 34px; }
.elder-entry .ee-main { flex: 1; }
.elder-entry .ee-t { font-size: var(--fs-title); font-weight: 700; color: #6b4e00; }
.elder-entry .ee-d { font-size: var(--fs-small); color: #8a6d00; }
.elder-entry .ee-btn {
  min-height: var(--touch); padding: 0 16px; border-radius: 22px;
  background: var(--color-elder); color: #3d2f00; font-weight: 700; white-space: nowrap;
}

/* ---------- 模块宫格 ---------- */
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.module-item {
  background: var(--color-card); border-radius: var(--radius); box-shadow: var(--shadow);
  min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--color-text); font-size: var(--fs-small);
}
.module-item .mi-ico { font-size: 30px; }
.module-item .mi-t { font-weight: 600; }
.module-item.hidden-module { display: none; }

/* 快捷胶囊 */
.quick-pills { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; }
.pill {
  flex-shrink: 0; min-height: var(--touch); padding: 0 16px; border-radius: 20px;
  background: #fff; border: 1px solid var(--color-line); color: var(--color-text-2);
  display: flex; align-items: center; font-size: var(--fs-small);
}
.pill.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ---------- 列表项 ---------- */
.list-item {
  background: var(--color-card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 10px;
}
.li-t { font-size: var(--fs); font-weight: 600; line-height: 1.5; }
.li-d { font-size: var(--fs-small); color: var(--color-text-2); margin-top: 4px; }
.li-meta { font-size: var(--fs-small); color: var(--color-text-3); margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.li-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }

/* 标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.tag-red { background: #fde8ea; color: var(--color-primary); }
.tag-blue { background: #e4eefc; color: var(--color-grid); }
.tag-green { background: #e4f5ea; color: var(--color-gov); }
.tag-orange { background: #fdf0e0; color: #a75f00; }
.tag-gray { background: #eef0f2; color: var(--color-text-3); }
.tag-purple { background: #f0eafa; color: #6a3fc0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--touch); padding: 0 20px; border-radius: 10px;
  background: var(--color-primary); color: #fff; font-weight: 600;
}
.btn:active { background: var(--color-primary-dark); }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: #fff; color: var(--color-text-2); border: 1px solid var(--color-line); }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: var(--fs-small); }
.btn.green { background: var(--color-gov); }
.btn.blue { background: var(--color-grid); }
.btn.gray { background: #eef0f2; color: var(--color-text-2); }
.btn.disabled, .btn[disabled] { background: #d9dbe0; color: #fff; pointer-events: none; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1; }

/* ---------- 表单 ---------- */
.fld { display: block; margin-bottom: 14px; }
.fld label { display: block; font-weight: 600; margin-bottom: 6px; }
.fld input, .fld textarea, .fld select {
  width: 100%; min-height: var(--touch); padding: 10px 12px;
  border: 1px solid var(--color-line); border-radius: 10px; background: #fff;
}
.fld textarea { min-height: 100px; resize: vertical; }
.fld .hint { font-size: var(--fs-small); color: var(--color-text-3); margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: var(--touch); padding: 0 16px; border-radius: 22px;
  border: 1px solid var(--color-line); background: #fff; color: var(--color-text-2);
  display: flex; align-items: center; font-size: var(--fs-small);
}
.chip.sel { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.chip.disabled { opacity: .45; pointer-events: none; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45);
  display: none; align-items: flex-end; justify-content: center;
}
.modal-mask.show { display: flex; }
.modal-box {
  width: 100%; max-width: 480px; max-height: 82vh; overflow-y: auto;
  background: #fff; border-radius: 16px 16px 0 0; padding: 18px 16px 24px;
}
.modal-box h3 { font-size: var(--fs-title); margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* ---------- 详情页 ---------- */
.detail-h1 { font-size: var(--fs-big); font-weight: 700; line-height: 1.5; margin-bottom: 8px; }
.detail-meta { font-size: var(--fs-small); color: var(--color-text-3); margin-bottom: 12px; }
.detail-content { font-size: var(--fs); line-height: 1.8; }
.detail-content p { margin-bottom: 10px; }
.step-item { display: flex; gap: 10px; margin-bottom: 12px; }
.step-num { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; margin-top: 2px; }
.material-item { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--color-line); }
.material-item::before { content: "☑"; color: var(--color-gov); }

/* 议事厅 */
.council-stage { display: flex; gap: 4px; margin-bottom: 14px; }
.cstage { flex: 1; text-align: center; font-size: 13px; padding: 6px 0; background: #eef0f2; color: var(--color-text-3); border-radius: 6px; }
.cstage.on { background: var(--color-primary); color: #fff; font-weight: 700; }
.cstage.done { background: #fde8ea; color: var(--color-primary); }
.vote-bar { height: 14px; border-radius: 7px; background: #eef0f2; overflow: hidden; margin: 4px 0; }
.vote-bar i { display: block; height: 100%; background: var(--color-primary); border-radius: 7px; }
.vote-row { margin-bottom: 10px; }
.vote-opt { display: flex; align-items: center; gap: 8px; }
.comment-item { padding: 10px 0; border-bottom: 1px solid var(--color-line); }
.comment-item:last-child { border-bottom: none; }
.ci-h { display: flex; justify-content: space-between; font-size: var(--fs-small); color: var(--color-text-3); margin-bottom: 4px; }
.ci-b { font-size: var(--fs); }

/* 预约时段 */
.slot-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.slot-cell {
  min-height: var(--touch); border: 1px solid var(--color-line); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; font-size: var(--fs-small);
}
.slot-cell .st { font-weight: 600; }
.slot-cell.sel { border-color: var(--color-primary); background: #fde8ea; color: var(--color-primary); }
.slot-cell.full { opacity: .4; pointer-events: none; }

/* 我的 / 统计 */
.mine-head {
  background: var(--color-primary); color: #fff; padding: 24px 16px 20px;
  display: flex; align-items: center; gap: 14px;
}
.mine-avatar { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; }
.mine-name { font-size: var(--fs-big); font-weight: 700; }
.mine-role { font-size: var(--fs-small); opacity: .9; margin-top: 2px; }
.mine-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: -20px; padding: 0 12px; }
.mine-cell { background: var(--color-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 6px; text-align: center; }
.mine-cell .mc-num { font-size: var(--fs-big); font-weight: 700; color: var(--color-primary); }
.mine-cell .mc-txt { font-size: var(--fs-small); color: var(--color-text-2); }
.menu-list { background: var(--color-card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--color-line); min-height: var(--touch); }
.menu-item:last-child { border-bottom: none; }
.menu-item .mi-ico { font-size: 22px; }
.menu-item .mi-t { flex: 1; }
.menu-item .mi-arrow { color: var(--color-text-3); }

/* 统计卡片 */
.stat-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-card { background: var(--color-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.stat-card .sc-num { font-size: 28px; font-weight: 700; color: var(--color-primary); }
.stat-card .sc-txt { font-size: var(--fs-small); color: var(--color-text-2); }

/* 进度条 */
.progress { height: 12px; border-radius: 6px; background: #eef0f2; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--color-gov); }

/* 开关 */
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 15px; background: #d9dbe0; transition: .2s; cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px;
  border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--color-primary); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,.8); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: var(--fs-small); z-index: 99; opacity: 0; transition: all .25s; pointer-events: none; max-width: 84%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 用户信息条 */
.userbar { display: flex; align-items: center; gap: 10px; background: var(--color-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin-bottom: 12px; }
.userbar .ub-name { font-weight: 600; }
.userbar .ub-role { font-size: var(--fs-small); color: var(--color-text-3); }
