/* 精益读书会 —— 手机优先。
   主色取丰禾 logo 青绿（#149999）再提亮一档到 #2FB5AD，与新厂房小程序的渐变亮端同色。
   档位用安灯口径的四色梯度，与主色分开，不抢戏。
   ⚠️ 全站固定浅色底，不做深色模式 —— 用户 2026-08-13 明确要求，
   目的是十几个人手机上看到的完全一致（截图发群里不会深浅不一）。别再加回 prefers-color-scheme。 */

:root {
  --paper: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #fafcfb;
  --ink: #172320;
  --ink-2: #3d4c48;
  --muted: #6d7a76;
  --rule: #e3e8e6;
  --rule-2: #eff3f1;
  --accent: #2fb5ad;
  --accent-dark: #179594;
  --accent-wash: #e6f5f3;
  --excellent: #1ca79b;
  --good: #5e9a3c;
  --pass: #bd921a;
  --improve: #c9572a;
  --none: #9aa4a0;
  --leave: #6b93b8;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 31, 28, 0.04), 0 8px 20px -16px rgba(20, 31, 28, 0.4);
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
  --serif: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --tabbar-h: 54px;
}

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

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* iOS 上 <16px 的输入框会触发自动放大 */
input, textarea, select, button { font-family: inherit; font-size: 16px; color: inherit; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hide { display: none !important; }

/* ---------- 顶栏 ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  background: var(--accent); color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.12);
}
.top .toplogo { height: 19px; width: auto; opacity: 0.95; }
.top h1 {
  font-family: var(--serif); font-size: 17px; font-weight: 700; letter-spacing: 0.02em;
  padding-left: 10px; margin-left: 2px; border-left: 1px solid rgba(255, 255, 255, 0.3);
}
.top .sub { font-size: 12px; opacity: 0.82; margin-left: auto; font-family: var(--mono); }
.top .back {
  background: rgba(255, 255, 255, 0.18); border: 0; color: #fff;
  padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 600;
}

/* ---------- 页面容器 ---------- */
main { padding: 12px 12px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px); max-width: 720px; margin: 0 auto; }
.page { display: none; }
.page.on { display: block; }

.card {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card h2 {
  font-family: var(--serif); font-size: 16px; font-weight: 700;
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px;
}
.card h2 .tag { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.08em; }

.muted { color: var(--muted); font-size: 13px; }
.tiny { font-size: 12px; color: var(--muted); }
.sec-label {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  color: var(--muted); text-transform: uppercase; margin: 18px 2px 8px;
}

/* ---------- 今日头条 ---------- */
.dayhead {
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff; border-radius: var(--radius); padding: 16px 16px 14px; margin-bottom: 12px;
}
.dayhead .n { font-family: var(--mono); font-size: 12px; opacity: 0.85; letter-spacing: 0.1em; }
.dayhead .t { font-family: var(--serif); font-size: 22px; font-weight: 700; margin-top: 2px; }
.dayhead .d { font-size: 13px; opacity: 0.9; margin-top: 4px; }
.dayhead .bar { height: 4px; background: rgba(255, 255, 255, 0.25); border-radius: 2px; margin-top: 12px; overflow: hidden; }
.dayhead .bar i { display: block; height: 100%; background: #fff; border-radius: 2px; }
.dayhead .milestone {
  display: inline-block; margin-top: 10px; background: rgba(255, 255, 255, 0.18);
  padding: 3px 10px; border-radius: 4px; font-size: 12px; font-weight: 600;
}

/* ---------- 小节 ---------- */
.sec { border-bottom: 1px solid var(--rule-2); padding: 11px 0; }
.sec:last-child { border-bottom: 0; padding-bottom: 0; }
.sec .row { display: flex; align-items: baseline; gap: 10px; }
.sec .pg { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 32px; }
.sec .tt { flex: 1; font-size: 15px; }
.sec .pen { background: none; border: 0; color: var(--accent); font-size: 13px; padding: 2px 4px; }
.sec .pen.has { color: var(--good); font-weight: 600; }
.sec textarea { margin-top: 8px; min-height: 60px; }
.sec .noteview {
  margin-top: 6px; font-size: 13px; color: var(--ink-2);
  background: var(--surface-2); border-left: 2px solid var(--accent); padding: 6px 10px; border-radius: 0 4px 4px 0;
}

/* ---------- 表单 ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }
input[type="text"], input[type="tel"], input[type="password"], input[type="date"], input[type="number"], textarea, select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--rule);
  border-radius: 8px; padding: 10px 12px; line-height: 1.6;
}
textarea { resize: vertical; min-height: 120px; font-size: 16px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-wash); border-color: var(--accent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 12px 18px; font-size: 16px; font-weight: 600; width: 100%;
}
.btn:active { opacity: 0.86; }
.btn[disabled] { background: #b8c4c0; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--rule); }
.btn.mini { width: auto; padding: 7px 14px; font-size: 14px; }
.btn.danger { background: var(--danger); }
.btnrow { display: flex; gap: 8px; }
.btnrow .btn { flex: 1; }

.counter { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; margin-top: 5px; }
.counter.ok { color: var(--good); }

/* ---------- 档位 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  color: #fff; white-space: nowrap;
}
.pill.excellent { background: var(--excellent); }
.pill.good { background: var(--good); }
.pill.pass { background: var(--pass); }
.pill.improve { background: var(--improve); }
.pill.none { background: var(--none); }
.pill.leave { background: var(--leave); }
.pill.pending { background: #b3bdb8; }
.pill.ghost { background: transparent; color: var(--muted); border: 1px solid var(--rule); }

/* 评分卡 */
.score { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; margin: 10px 0; }
.score div { background: var(--surface); padding: 9px 4px; text-align: center; }
.score b { display: block; font-family: var(--mono); font-size: 17px; color: var(--accent); }
.score span { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.quote { background: var(--accent-wash); border-radius: 8px; padding: 10px 12px; font-size: 14px; color: var(--accent-dark); margin-top: 8px; }
.quote b { display: block; font-size: 12px; opacity: 0.75; margin-bottom: 2px; }

/* ---------- 榜单 ---------- */
.lampbar { display: flex; gap: 6px; margin-bottom: 12px; }
.lampbar div { flex: 1; text-align: center; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 2px; }
.lampbar b { display: block; font-family: var(--mono); font-size: 19px; line-height: 1.2; }
.lampbar span { font-size: 11px; color: var(--muted); }
.lampbar .e b { color: var(--excellent); } .lampbar .g b { color: var(--good); }
.lampbar .p b { color: var(--pass); } .lampbar .i b { color: var(--improve); }
.lampbar .n b { color: var(--none); }

.mrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--rule-2); }
.mrow:last-child { border-bottom: 0; }
.mrow .who { flex: 1; min-width: 0; }
.mrow .who b { font-weight: 600; font-size: 15px; }
.mrow .who span { display: block; font-size: 12px; color: var(--muted); }
.mrow.me { background: var(--accent-wash); margin: 0 -14px; padding: 10px 14px; border-radius: 6px; }

/* 走势条 */
.trend { display: flex; align-items: flex-end; gap: 3px; height: 56px; margin: 10px 0 4px; }
.trend i { flex: 1; background: var(--accent-wash); border-radius: 2px 2px 0 0; position: relative; min-height: 3px; }
.trend i.on { background: var(--accent); }

/* ---------- 排期 ---------- */
.dayrow { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--rule-2); }
.dayrow:last-child { border-bottom: 0; }
.dayrow .no { font-family: var(--mono); font-size: 12px; font-weight: 600; min-width: 30px; padding-top: 2px; }
.dayrow .no span { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.dayrow .body { flex: 1; min-width: 0; }
.dayrow .ttl { font-size: 14px; line-height: 1.5; }
.dayrow .ttl i { font-style: normal; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.dayrow.today { background: var(--accent-wash); margin: 0 -14px; padding: 11px 14px; border-radius: 6px; }
.chapline { font-family: var(--serif); font-weight: 700; font-size: 15px; margin: 14px 0 2px; color: var(--accent-dark); }
.chapline span { font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 6px; }

/* ---------- 感悟墙 ---------- */
.post { border-bottom: 1px solid var(--rule-2); padding: 13px 0; }
.post:last-child { border-bottom: 0; }
.post .h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.post .h b { font-size: 14px; }
.post .h .tiny { margin-left: auto; }
.post .c { font-size: 14px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.post .imgs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.post .imgs img { width: 76px; height: 76px; object-fit: cover; border-radius: 6px; border: 1px solid var(--rule); }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs .t { position: relative; width: 72px; height: 72px; }
.thumbs .t img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; border: 1px solid var(--rule); }
.thumbs .t button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: 0; font-size: 14px; line-height: 1; }
.thumbs .add { width: 72px; height: 72px; border: 1px dashed var(--rule); border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 22px; }

/* ---------- 底部页签 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; background: var(--surface); border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar button {
  flex: 1; background: none; border: 0; padding: 7px 0 6px;
  color: var(--muted); font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  height: var(--tabbar-h);
}
.tabbar button svg { width: 21px; height: 21px; }
.tabbar button.on { color: var(--accent); font-weight: 600; }

/* ---------- 浮层 ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 60; background: rgba(20, 31, 28, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet .inner {
  background: var(--paper); width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto;
  border-radius: 14px 14px 0 0; padding: 16px 14px calc(env(safe-area-inset-bottom, 0px) + 20px);
}
.sheet h3 { font-family: var(--serif); font-size: 17px; margin-bottom: 12px; display: flex; align-items: center; }
.sheet h3 button { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; }

/* 提示条 */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px); transform: translateX(-50%);
  background: rgba(20, 31, 28, 0.92); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 90; max-width: 88vw; text-align: center; transition: opacity 0.2s;
}

/* 登录页 */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px; max-width: 460px; margin: 0 auto; }
.login .brand { text-align: center; margin-bottom: 26px; }
.login .brand img { height: 46px; width: auto; margin-bottom: 20px; }
.login .brand .bk { font-family: var(--serif); font-size: 30px; font-weight: 700; letter-spacing: 0.02em; }
.login .brand .by { color: var(--muted); font-size: 13px; margin-top: 4px; }
.login .brand .tagline { display: inline-block; margin-top: 12px; background: var(--accent-wash); color: var(--accent-dark); font-size: 13px; padding: 4px 14px; border-radius: 999px; }
.login .step { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 18px 16px; box-shadow: var(--shadow); }
.namegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 6px; }
.namegrid button { background: var(--surface-2); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 6px; font-size: 15px; font-weight: 600; }
.namegrid button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.namegrid button span { display: block; font-size: 11px; font-weight: 400; opacity: 0.7; }

.pinbox { display: flex; gap: 8px; justify-content: center; margin: 10px 0 4px; }
.pinbox input { width: 52px; height: 56px; text-align: center; font-size: 24px; font-family: var(--mono); padding: 0; }

/* ---------- 封面欢迎页 ---------- */
.welcome {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(165deg, #2fb5ad 0%, #179594 45%, #0f6b6a 100%);
  display: flex; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
  transition: opacity 0.45s ease;
}
.welcome.fade { opacity: 0; pointer-events: none; }
.welcome .w-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 18px; max-width: 340px; width: 100%;
}
/* 封面是书的实拍，白底，给个圆角和阴影让它像"摆在桌上的一本书" */
.welcome .w-cover {
  width: 100%; max-height: 62vh; object-fit: contain;
  border-radius: 6px; box-shadow: 0 18px 42px -12px rgba(0, 0, 0, 0.45);
  background: #fff;
}
.welcome .w-foot { text-align: center; }
.welcome .w-logo { height: 26px; width: auto; opacity: 0.95; }
.welcome .w-txt { color: #fff; font-size: 14px; letter-spacing: 0.06em; margin-top: 8px; opacity: 0.92; }
.welcome .w-enter {
  background: rgba(255, 255, 255, 0.16); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 999px;
  padding: 9px 26px; font-size: 15px; font-weight: 600;
}
.welcome .w-enter:active { background: rgba(255, 255, 255, 0.28); }

/* ---------- 规则页 ---------- */
.rule-h {
  font-family: var(--serif); font-size: 15px; font-weight: 700;
  margin: 16px 0 6px; padding-left: 9px; border-left: 3px solid var(--accent);
}
.rule-h:first-child { margin-top: 0; }
.rule-p { font-size: 14px; color: var(--ink-2); margin: 5px 0; }
.rule-tbl { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.rule-tbl th, .rule-tbl td { border: 1px solid var(--rule); padding: 7px 9px; text-align: left; }
.rule-tbl th { background: var(--surface-2); font-weight: 600; font-size: 13px; color: var(--ink-2); }
.rule-tbl td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.warn {
  background: #fdf3ec; border: 1px solid #f0d7c4; border-radius: 8px;
  padding: 10px 12px; font-size: 13px; color: #8a4a22; margin-top: 10px;
}

/* ---------- 台账 ---------- */
.led { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--rule-2); }
.led:last-child { border-bottom: 0; }
.led .who { flex: 1; min-width: 0; }
.led .who b { font-size: 14px; }
.led .who span { display: block; font-size: 12px; color: var(--muted); }
.led .amt { font-family: var(--mono); font-size: 16px; font-weight: 600; white-space: nowrap; }
.led .amt.reward { color: var(--excellent); }
.led .amt.donation { color: var(--improve); }
.fundbar { display: flex; gap: 6px; margin-bottom: 10px; }
.fundbar div { flex: 1; background: var(--surface-2); border: 1px solid var(--rule); border-radius: 8px; padding: 9px 6px; text-align: center; }
.fundbar b { display: block; font-family: var(--mono); font-size: 17px; }
.fundbar span { font-size: 11px; color: var(--muted); }

/* 名次徽章 */
.medal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; font-family: var(--mono);
  font-size: 12px; font-weight: 700; flex: none; color: #fff; background: var(--none);
}
.medal.m1 { background: #d4a017; }
.medal.m2 { background: #9aa5ad; }
.medal.m3 { background: #b3763f; }
.medal.plain { background: transparent; color: var(--muted); font-weight: 400; }

/* 周次切换条 */
.weeks { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 2px; }
.weeks button {
  flex: none; background: var(--surface); border: 1px solid var(--rule); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; color: var(--ink-2);
}
.weeks button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
