/* =============================================================================
 * style.css —— 员工端手机网页样式
 * 设计目标：手机上好看好用、字大、按钮大（≥44px 点击区）、反馈明确。
 * 结构：基础变量 → 布局骨架 → 通用组件 → 各页面 → 动画 → 大屏适配
 * ========================================================================== */

/* ---------------------------------------------------------------------------
 * 1. 变量与基础
 * ------------------------------------------------------------------------ */
:root {
  --brand: #2f6feb;
  --brand-dark: #1f54c0;
  --brand-soft: #eaf1ff;
  --ok: #17a34a;
  --ok-soft: #e6f7ec;
  --warn: #d97706;
  --warn-soft: #fff5e6;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --ink: #1b1f27;
  --ink-2: #4a5361;
  --ink-3: #8a94a6;
  --line: #e6e9ef;
  --line-2: #f0f2f6;
  --bg: #f4f6fa;
  --card: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(24, 39, 75, .06);
  --tap: 44px;
  --topbar-h: 52px;
  --tabbar-h: 58px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

/* hidden 属性必须真的隐藏：否则 .topbar/.tabbar 的 display:flex 会盖掉浏览器默认样式 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body { min-height: 100vh; }

img { max-width: 100%; display: block; border: 0; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
input, textarea, select, button { font-size: 16px; }   /* ≥16px 防止 iOS 自动缩放 */

.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.danger { color: var(--danger); }
.chev { color: var(--ink-3); font-size: 20px; line-height: 1; }

/* ---------------------------------------------------------------------------
 * 2. 布局骨架：顶栏 / 内容 / 底部 Tab
 * ------------------------------------------------------------------------ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  padding-right: 8px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(12px);
  z-index: 60;
}
.topbar-title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-back {
  width: 40px; height: 40px;
  min-width: 40px;
  border: 0;
  background: transparent;
  font-size: 30px;
  line-height: 1;
  color: var(--ink);
  padding: 0 0 4px 0;
  border-radius: 50%;
}
.topbar-back:active { background: var(--line-2); }
.topbar-extra { min-width: 44px; display: flex; justify-content: flex-end; }
.topbar-extra:empty { min-width: 8px; }

.view {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--topbar-h) + var(--safe-top) + 10px) 12px
           calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
}
/* 阅读器：全宽显示书页（由 app.js 按路由加类，不依赖 :has()） */
.view.view-full {
  padding-left: 0;
  padding-right: 0;
  padding-bottom: calc(var(--safe-bottom) + 10px);
}
.view.view-full .reader-info,
.view.view-full .reader-hint,
.view.view-full .reader-bar {
  padding-left: 12px;
  padding-right: 12px;
}

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: rgba(255, 255, 255, .98);
  border-top: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(12px);
  z-index: 60;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: var(--ink-3);
  min-height: var(--tap);
  font-size: 11px;
}
.tab-icon { font-size: 21px; line-height: 1.1; filter: grayscale(1); opacity: .65; }
.tab-label { line-height: 1.2; }
.tab-active { color: var(--brand); }
.tab-active .tab-icon { filter: none; opacity: 1; }
.tab-active .tab-label { font-weight: 600; }

.bottom-space { height: 8px; }

/* ---------------------------------------------------------------------------
 * 3. 通用组件：卡片 / 按钮 / 表单 / 标签 / 提示
 * ------------------------------------------------------------------------ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .06s ease, opacity .15s ease, background .15s ease;
  text-align: center;
}
.btn:active { transform: scale(.985); opacity: .9; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 52px; font-size: 17px; }
.btn-mini { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:active { background: var(--brand-dark); }
.btn-success { background: var(--ok); color: #fff; }
.btn-warn { background: var(--warn); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: var(--danger-soft); color: var(--danger); }
.btn-ghost {
  background: #fff;
  color: var(--ink-2);
  border-color: var(--line);
}
.btn + .btn { margin-top: 8px; }

.link-btn {
  display: inline-block;
  background: none;
  border: 0;
  color: var(--brand);
  font-size: 15px;
  padding: 10px 4px;
  min-height: var(--tap);
  cursor: pointer;
}
.link-btn.danger { color: var(--danger); }
.link-btn.small { min-height: 28px; padding: 2px 6px; font-size: 13px; }

.field { display: block; margin-bottom: 12px; }
.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.input, .textarea {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, background .15s;
}
.input:focus, .textarea:focus {
  border-color: var(--brand);
  background: #fff;
}
.input-upper { text-transform: uppercase; letter-spacing: .06em; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.counter { text-align: right; font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.counter.over { color: var(--danger); font-weight: 600; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.7;
  background: var(--line-2);
  color: var(--ink-2);
  font-weight: 600;
  vertical-align: middle;
  margin-left: 6px;
}
.tag-date { background: var(--brand-soft); color: var(--brand-dark); margin-left: 0; }
.tag-makeup { background: var(--warn-soft); color: var(--warn); }
.tag-admin { background: #f3e8ff; color: #7c3aed; }

.notice {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.6;
  margin-top: 10px;
}
.notice-info { background: var(--brand-soft); color: #14428f; }
.notice-warn { background: var(--warn-soft); color: #92400e; }
.notice-error { background: var(--danger-soft); color: #991b1b; }

.error-box {
  background: var(--danger-soft);
  color: #991b1b;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  margin-bottom: 10px;
  word-break: break-word;
}

.empty { text-align: center; padding: 34px 16px; }
.empty-icon { font-size: 44px; margin-bottom: 8px; }
.empty-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.empty-hint { color: var(--ink-3); font-size: 14px; margin-bottom: 14px; white-space: pre-line; }
.empty-action { display: flex; justify-content: center; }

/* 骨架屏 */
.skeleton-card { overflow: hidden; }
.sk-line {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 37%, #eef1f6 63%);
  background-size: 400% 100%;
  animation: sk 1.3s ease infinite;
  margin-bottom: 10px;
}
.sk-40 { width: 40%; } .sk-60 { width: 60%; } .sk-90 { width: 90%; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* 统计小方块 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.stat-cell {
  background: var(--line-2);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
}
.stat-value { font-size: 17px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.stat-label { font-size: 12px; color: var(--ink-3); }

.stat-chip {
  flex: 1;
  text-align: center;
  padding: 6px 2px;
}
.stat-chip b { display: block; font-size: 17px; font-weight: 700; }
.stat-chip span { font-size: 12px; color: var(--ink-3); }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap);
  padding: 8px 0;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink);
  font-size: 16px;
}
.list-row:last-child { border-bottom: 0; }
.list-row .danger { color: var(--danger); }

.chip {
  min-height: 34px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 14px;
  margin: 0 8px 8px 0;
}
.chip-on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.filter-row { display: flex; flex-wrap: wrap; margin-bottom: 4px; }

.load-more-wrap { padding: 6px 0 12px; }
.bottom-space { height: 6px; }

/* ---------------------------------------------------------------------------
 * 4. 全局反馈：加载遮罩 / Toast / 弹窗
 * ------------------------------------------------------------------------ */
.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 22, 34, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 200;
}
.loading-mask.show { opacity: 1; pointer-events: auto; }
.loading-box {
  background: #fff;
  border-radius: 16px;
  padding: 20px 24px;
  min-width: 132px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(16, 22, 34, .18);
}
.spinner {
  width: 26px; height: 26px;
  margin: 0 auto 10px;
  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); } }
.loading-text { font-size: 14px; color: var(--ink-2); }

.toast-host {
  position: fixed;
  left: 0; right: 0;
  top: calc(var(--safe-top) + 10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  z-index: 300;
  pointer-events: none;
}
.toast {
  max-width: 560px;
  width: 100%;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: rgba(27, 31, 39, .94);
  color: #fff;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(16, 22, 34, .22);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .2s ease, transform .2s ease;
  word-break: break-word;
}
.toast-in { opacity: 1; transform: translateY(0); }
.toast-error { background: rgba(153, 27, 27, .96); }
.toast-ok { background: rgba(21, 128, 61, .96); }
.toast-warn { background: rgba(146, 64, 14, .96); }
.toast-icon { flex: 0 0 auto; }

.modal-host { position: fixed; inset: 0; z-index: 400; pointer-events: none; }
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 22, 34, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: auto;
}
.modal-mask.modal-in { opacity: 1; }
.modal-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 18px 16px 14px;
  box-shadow: 0 16px 40px rgba(16, 22, 34, .24);
  transform: scale(.96);
  transition: transform .18s ease;
}
.modal-mask.modal-in .modal-card { transform: scale(1); }
.modal-title { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
.modal-body {
  font-size: 15px;
  color: var(--ink-2);
  margin-bottom: 16px;
  white-space: pre-line;
  max-height: 46vh;
  overflow-y: auto;
}
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; margin-top: 0; }

/* 启动画面 */
.boot-screen { text-align: center; padding: 80px 20px; }
.boot-logo {
  width: 66px; height: 66px;
  margin: 0 auto 12px;
  border-radius: 18px;
  background: var(--brand);
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.boot-screen h1 { font-size: 20px; margin: 0 0 6px; }

/* ---------------------------------------------------------------------------
 * 5. 登录页
 * ------------------------------------------------------------------------ */
.login-wrap { padding: 18px 0 40px; text-align: center; }
.login-logo {
  width: 60px; height: 60px;
  margin: 6px auto 10px;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  font-size: 30px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-title { font-size: 21px; margin: 0 0 4px; }
.login-company { color: var(--ink-3); font-size: 14px; margin-bottom: 16px; }
.login-card { text-align: left; margin-top: 8px; }
.login-foot { margin-top: 14px; }
.login-rules { font-size: 13px; color: var(--ink-3); }
.login-tip { font-size: 13px; color: var(--ink-3); margin: 12px 0 0; line-height: 1.6; }
.login-wecom-icon { font-size: 40px; text-align: center; }
.login-wecom-title { text-align: center; font-size: 17px; font-weight: 600; margin-bottom: 6px; }

/* ---------------------------------------------------------------------------
 * 6. 首页
 * ------------------------------------------------------------------------ */
.task-card { padding: 16px 14px; }
.task-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.task-book { font-size: 21px; margin: 2px 0 4px; line-height: 1.35; }
.task-chapter { color: var(--ink-2); font-size: 15px; margin-bottom: 8px; }
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--ink-3);
  font-size: 14px;
  margin-bottom: 6px;
}
.task-actions { margin-top: 12px; }
.task-hint { margin-top: 10px; font-size: 13px; color: var(--ink-3); line-height: 1.6; }
.task-empty { text-align: center; padding: 10px 0 4px; }

.recent-bar { display: flex; gap: 6px; }
.recent-cell {
  flex: 1;
  border-radius: 10px;
  padding: 8px 2px;
  text-align: center;
  background: var(--line-2);
  color: var(--ink-3);
}
.recent-mark { font-size: 16px; font-weight: 700; line-height: 1.3; }
.recent-label { font-size: 11px; }
.recent-cell.is-done { background: var(--ok-soft); color: var(--ok); }
.recent-cell.is-draft { background: var(--warn-soft); color: var(--warn); }
.recent-cell.is-miss { background: var(--danger-soft); color: var(--danger); }
.recent-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 8px;
  flex-wrap: wrap;
}
.lg-done { color: var(--ok); }
.lg-draft { color: var(--warn); }
.lg-none { color: var(--ink-3); }

.reminder-card { border-left: 4px solid var(--brand); }
.reminder-date { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.reminder-content { font-size: 15px; color: var(--ink-2); line-height: 1.7; }
.reminder-foot { font-size: 12px; color: var(--ink-3); margin-top: 8px; }

.home-actions { display: flex; flex-direction: column; align-items: center; }

/* ---------------------------------------------------------------------------
 * 7. 阅读器（核心）
 * ------------------------------------------------------------------------ */
.reader {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reader-info { text-align: center; }
.reader-book { font-size: 16px; font-weight: 700; }
.reader-chapter { font-size: 14px; color: var(--ink-2); }
.reader-note {
  font-size: 13px;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: 6px;
}

.reader-pages {
  display: flex;
  overflow-x: auto;
  /* 默认允许纵向滚动：书页按宽度铺满后往往比屏幕高，
     需要能上下滑动看完一页（这是"看得清"的关键）。 */
  overflow-y: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0;
  background: #dfe3ea;
  border-radius: 12px;
  height: 56vh;
  min-height: 240px;
  max-height: 620px;
}
.reader-pages::-webkit-scrollbar { display: none; }
.reader-page {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  /* 每一页自己纵向滚动。
     为什么不让外层 .reader-pages 滚：它必须保持固定高度，
     否则横向分页（scroll-snap + scrollLeft 算页码）会失效。
     所以固定外层高度、让每页内部滚动 —— 两者才能共存。 */
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;   /* 滚到边界不要带动外层翻页 */
  display: grid;
  place-items: start center;        /* 宽图/短页居中，长页从顶部开始 */
}
.reader-page::-webkit-scrollbar { display: none; }
.reader-page img {
  /* 关键改动：按【宽度】铺满，而不是按高度压缩。
     原来的 max-height:100% + object-fit:contain 让"高度先成为瓶颈"：
     任何比屏幕高的书页都被压到约 448px 高、横向只剩 ~320px，
     一行正文只有 300 多像素 —— 手机上怎么看都是糊的。
     实测：把存储图从 1080 加宽到 2160，屏幕上显示的横向像素完全不变
     （都是 336px），体积却涨 2.5 倍，纯属浪费流量。
     改成按宽度铺满后，横向用满屏幕宽度（手机上 360~390px），文字明显变大；
     页面比屏幕高时在页内纵向滚动看完，再左右滑动翻到下一页。 */
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  background: #fff;
}

/* 「整页」模式：一眼看全一页，适合快速翻页或看版面。由工具栏切换。
 *
 * 高度由 JS 量出后写成内联 --rd-fit-h（见 app.js applyFitPage）。
 * 为什么不用纯 CSS：图片高度要精确等于"页面可视高度"，而
 *   · max-height: 100% 在 flex 拉伸出来的父容器里解析不出确定值
 *   · height: 56vh 会与 .reader-pages 的实际高度差几像素（还受 max-height 影响）
 * 实测两者都会让图片略微超出、多出一条不必要的滚动条。
 * 直接量最准。JS 未执行时下面的 56vh 作为兜底。 */
.reader-pages.fit-page .reader-page {
  overflow-y: hidden;
  place-items: center;
}
.reader-pages.fit-page .reader-page img {
  width: 100%;
  height: var(--rd-fit-h, 56vh);
  max-height: var(--rd-fit-h, 620px);
  object-fit: contain;
}
/* 阅读器里的「显示模式」切换按钮（铺满宽度 / 整页） */
.reader-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rd-mode {
  margin-left: auto;
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid var(--color-border, #d8dde6);
  border-radius: 999px;
  background: #fff;
  color: var(--color-primary, #2563eb);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.rd-mode:active { background: #eef2ff; }

/* 全屏看原图（书页细节 / 打卡配图） */
.img-full {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(12, 15, 20, .96);
  display: flex;
  flex-direction: column;
}
.img-full-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  color: #e6e9ef;
  font-size: 12px;
  gap: 10px;
}
.img-full-hint { opacity: .75; }
.img-full-x {
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.img-full-stage {
  flex: 1 1 auto;
  overflow: hidden;                 /* 缩放/拖动由 JS 控制 transform */
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;               /* 交给我们自己处理手势 */
}
.img-full-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  transition: transform .06s linear;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

.reader-error {
  margin: auto;
  padding: 20px;
  color: var(--ink-2);
  text-align: center;
  font-size: 15px;
}

.reader-hint {
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}
.reader-hint.hint-recording { color: var(--danger); font-weight: 600; }

.page-progress {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.page-progress-fill {
  height: 100%;
  background: var(--brand);
  transition: width .25s ease;
}
.reader-status {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.reader-status.is-uploading::after {
  content: '录音上传中…';
  color: var(--warn);
  font-size: 13px;
}
.rd-audio-zero { color: var(--ink-3); }

.rd-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--danger-soft);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.rd-rec-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.1s ease-in-out infinite;
}
.rd-timer-text {
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 700;
  color: var(--danger);
  min-width: 58px;
}
.rd-waves { display: flex; align-items: flex-end; gap: 3px; height: 20px; flex: 1; }
.rd-waves i {
  display: block;
  width: 3px;
  background: var(--danger);
  border-radius: 2px;
  animation: wave .9s ease-in-out infinite;
}
.rd-waves i:nth-child(1) { animation-delay: 0s; }
.rd-waves i:nth-child(2) { animation-delay: .12s; }
.rd-waves i:nth-child(3) { animation-delay: .24s; }
.rd-waves i:nth-child(4) { animation-delay: .36s; }
.rd-waves i:nth-child(5) { animation-delay: .48s; }
.rd-timer-limit { font-size: 12px; color: var(--ink-3); }
@keyframes wave { 0%, 100% { height: 5px; } 50% { height: 18px; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.rd-progress-wrap {
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 8px;
}
.rd-progress-fill { height: 100%; background: var(--warn); transition: width .3s ease; }

/* 录音时的实时音量条：让员工当场看到"声音太小"。
   线上实测 6/11 条录音比正常说话小 20~30 dB（说话离麦太远），
   同事外放基本听不见 —— 必须录的当下就提醒，事后发现就晚了。 */
.rd-mic {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--ink-3);
}
.rd-mic-label { flex: none; }
.rd-mic-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.rd-mic-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ok, #2fa84f);
  transition: width .12s linear;
}
.rd-mic.is-quiet .rd-mic-bar i { background: var(--danger, #d33); }
.rd-mic.is-loud .rd-mic-bar i { background: var(--warn, #e8a33d); }
.rd-mic-hint { flex: none; max-width: 62%; text-align: right; }
.rd-mic.is-quiet .rd-mic-hint { color: var(--danger, #d33); font-weight: 600; }

.rd-notice { font-size: 13px; color: var(--ink-3); text-align: center; margin-top: 8px; }

/* ---------------------------------------------------------------------------
 * 录音"保存中" / "上传失败"
 *
 * 真实反馈：「点结束打卡后没反应，也不跳转」。原因是旧实现要等上传完才重绘，
 * 慢网络下界面几十秒不变，用户以为卡住就走了，正在上传的录音就丢了。
 * 这块 UI 必须在点下按钮的**同一帧**出现，所以做得足够显眼。
 * ------------------------------------------------------------------------ */
.rd-saving {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-2, #f5f7fa);
  border: 1px solid var(--line-2, #e5e7eb);
}
.rd-saving-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink, #1f2937);
}
.rd-saving-title b { margin-left: auto; color: var(--brand, #2563eb); }
.rd-saving-spin {
  width: 14px; height: 14px; flex: none;
  border: 2px solid rgba(37, 99, 235, .25);
  border-top-color: var(--brand, #2563eb);
  border-radius: 50%;
  animation: rd-spin .8s linear infinite;
}
.rd-saving-track {
  margin-top: 8px;
  height: 6px;
  border-radius: 3px;
  background: var(--line-2, #e5e7eb);
  overflow: hidden;
}
.rd-saving-track > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--brand, #2563eb);
  transition: width .2s linear;
}
.rd-saving-hint { margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.rd-saving-hint b { color: var(--danger, #d33); }

.rd-failed {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}
.rd-failed-title { font-size: 15px; font-weight: 600; color: #b45309; }
.rd-failed-hint { font-size: 12px; color: #92400e; margin: 6px 0 10px; line-height: 1.55; }
.rd-failed .btn { margin-top: 6px; }

@keyframes rd-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .rd-saving-spin { animation: none; }
  .rd-saving-track > i { transition: none; }
}

.rd-tip { font-size: 12px; color: var(--ink-3); margin-top: 10px; line-height: 1.6; }
.rd-audios { margin-top: 10px; }
.rd-audios audio { width: 100%; margin-top: 4px; }

/* ---------------------------------------------------------------------------
 * 8. 写感悟 / 图片网格 / 音频
 * ------------------------------------------------------------------------ */
.compose-head { padding: 4px 2px 10px; }
.compose-book { font-size: 19px; font-weight: 700; }
.compose-chapter { color: var(--ink-2); font-size: 14px; }
.compose-actions { margin: 14px 0 6px; }
.compose-danger { text-align: center; padding: 4px 0 10px; }

.img-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.img-grid.g1 { grid-template-columns: 1fr; }
.img-grid.g2 { grid-template-columns: repeat(2, 1fr); }
.img-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--line-2);
}
.img-cell img { width: 100%; height: 100%; object-fit: cover; }
.img-uploading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 12px;
  color: var(--ink-3);
}
.img-cell.is-loading { animation: sk 1.3s ease infinite; }
.img-del {
  position: absolute;
  top: 2px; right: 2px;
  width: 26px; height: 26px;
  min-height: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}
.feed-imgs { margin-top: 4px; }
.file-btn { margin-top: 8px; cursor: pointer; }

.audio-list { display: flex; flex-direction: column; gap: 8px; }
.audio-item-label { font-size: 13px; color: var(--ink-3); }
.audio-item audio { width: 100%; height: 40px; }

/* ---------------------------------------------------------------------------
 * 9. 阅读圈
 * ------------------------------------------------------------------------ */
.feed-stats {
  display: flex;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px 0;
  margin-bottom: 12px;
}
.feed-item { padding: 14px; }
.feed-head { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px;
  min-width: 38px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
}
.feed-who { flex: 1; min-width: 0; }
.feed-name { font-weight: 600; font-size: 15px; }
.feed-sub { font-size: 12px; color: var(--ink-3); }
.feed-book { font-size: 12px; color: var(--ink-3); max-width: 40%; text-align: right; }
.feed-content {
  font-size: 15px;
  line-height: 1.75;
  margin: 10px 0 4px;
  word-break: break-word;
}
.feed-audios { margin-top: 8px; }
.feed-audios audio { width: 100%; height: 40px; margin-top: 6px; }
.feed-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line-2);
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 14px;
  padding: 0;
  cursor: pointer;
}
.like-btn.is-on { color: var(--danger); }
.feed-chapter { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.comment-preview {
  margin-top: 8px;
  background: var(--line-2);
  border-radius: 10px;
  padding: 8px 10px;
}
.cp-line { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.cp-line b { color: var(--ink); }

.post-book { font-size: 13px; color: var(--ink-3); margin: 10px 0 4px; }
.post-content { font-size: 16px; line-height: 1.8; word-break: break-word; }
.post-stats {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
  flex-wrap: wrap;
}
.comment-item { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.comment-item:last-child { border-bottom: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.comment-text { font-size: 15px; line-height: 1.7; margin-top: 2px; word-break: break-word; }
.comment-form { margin-top: 12px; }
.comment-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

/* ---------------------------------------------------------------------------
 * 10. 补卡日历
 * ------------------------------------------------------------------------ */
.month-nav { display: flex; align-items: center; justify-content: space-between; }
.month-label { font-size: 17px; font-weight: 700; }
.mk-summary { display: flex; margin-top: 10px; border-top: 1px solid var(--line-2); padding-top: 8px; }

.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.cal-wd { text-align: center; font-size: 12px; color: var(--ink-3); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  min-height: 52px;
  border-radius: 10px;
  background: var(--line-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--ink-3);
  padding: 2px;
  position: relative;
}
.cal-cell.is-blank { background: transparent; }
.cal-day { font-size: 14px; font-weight: 600; color: var(--ink-2); line-height: 1.2; }
.cal-mark { font-size: 11px; line-height: 1.4; }
.cal-cell.is-done { background: var(--ok-soft); }
.cal-cell.is-done .cal-mark { color: var(--ok); font-weight: 700; }
.cal-cell.is-done .cal-day { color: #0f7a37; }
.cal-cell.is-can {
  background: var(--brand-soft);
  border: 1.5px dashed var(--brand);
}
.cal-cell.is-can .cal-mark { color: var(--brand-dark); font-weight: 700; }
.cal-cell.is-can .cal-day { color: var(--brand-dark); }
.cal-cell.is-can:active { background: #d8e6ff; }
.cal-cell.is-draft { background: var(--warn-soft); }
.cal-cell.is-draft .cal-mark { color: var(--warn); font-weight: 700; }
.cal-cell.is-future { opacity: .55; }
.cal-cell.is-notask { opacity: .6; }
.cal-cell.is-loading { animation: sk 1.1s ease infinite; }

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-3);
  padding: 0 4px 12px;
}
.lg { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot-done { background: var(--ok); }
.dot-can { background: var(--brand); }
.dot-none { background: #cbd2dd; }
.dot-future { background: #e3e7ee; }

/* ---------------------------------------------------------------------------
 * 11. 我的 / 记录 / 密码
 * ------------------------------------------------------------------------ */
.me-head { display: flex; align-items: center; gap: 12px; }
.me-avatar {
  width: 54px; height: 54px;
  min-width: 54px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
}
.me-name { font-size: 18px; font-weight: 700; }
.me-sub { font-size: 13px; color: var(--ink-3); }
.invite-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--brand-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.invite-box span {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap);
  font-size: 16px;
}
.switch-row input { width: 24px; height: 24px; accent-color: var(--brand); }
.notif-item { padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.notif-item:last-child { border-bottom: 0; }
.notif-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.notif-content { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.version-foot { text-align: center; font-size: 12px; color: var(--ink-3); padding: 12px 0 4px; }

.rec-item .rec-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.rec-date { font-size: 13px; color: var(--ink-2); }
.rec-time { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.rec-book { font-size: 15px; font-weight: 600; margin: 6px 0 4px; }
.rec-content { font-size: 14px; color: var(--ink-2); line-height: 1.7; word-break: break-word; }
.rec-meta { margin-top: 6px; }
.rec-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.rec-actions .btn { margin-top: 0; }

/* ---------------------------------------------------------------------------
 * 12. 大屏适配（平板 / 桌面浏览器预览）
 * ------------------------------------------------------------------------ */
@media (min-width: 760px) {
  .view { padding-left: 20px; padding-right: 20px; }
  .reader-pages { height: 62vh; }
  .img-grid { grid-template-columns: repeat(4, 1fr); }
  .feed-imgs.g3 { grid-template-columns: repeat(3, 1fr); max-width: 420px; }
}

/* =============================================================================
 * 自制音频播放器（.ap）—— 与 assets/audioplayer.js 配套
 *
 * 为什么不用原生 <audio controls>：MediaRecorder 录的 WebM 没有 duration 头，
 * 浏览器 duration = Infinity，原生控件不会画进度条也不显示总时长。
 * 详见 audioplayer.js 顶部说明。
 * ========================================================================== */

.ap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-top: 6px;
  border: 1px solid var(--line-2, #e5e7eb);
  border-radius: 8px;
  background: var(--bg-2, #fafafa);
}
.ap audio { display: none; }          /* 只用它来解码，界面全部自绘 */

.ap-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--brand, #2563eb);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ap-btn:hover { filter: brightness(1.06); }
.ap-btn:disabled { opacity: .5; cursor: default; }

.ap-body { flex: 1 1 auto; min-width: 0; }

.ap-track {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--line-2, #e5e7eb);
  cursor: pointer;
}
.ap-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  border-radius: 3px;
  background: var(--brand, #2563eb);
  transition: width .12s linear;
}
.ap-knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand, #2563eb);
  transform: translateY(-50%);
  pointer-events: none;
  transition: left .12s linear;
}
.ap-time {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3, #6b7280);
  font-variant-numeric: tabular-nums;
}
.ap-sep { opacity: .5; }
.ap.is-playing .ap-btn { background: var(--danger, #dc2626); }

/* ── 缓冲中 ───────────────────────────────────────────────────────────────
   真实反馈：「暂停第一个后点第二个需要等待 10 秒以上，不清楚是缓冲还是怎么」。
   慢链路上首次播放确实要等一会儿（要建连接 + 拉数据），
   所以必须给一个**明确**的"正在缓冲"视觉反馈，否则用户以为播放器坏了。

   is-loading   = 点了还没开始播（首次加载）
   is-buffering = 播到一半数据不够，等下载
   ─────────────────────────────────────────────────────────────────────── */
.ap.is-loading .ap-btn,
.ap.is-buffering .ap-btn {
  color: transparent;                 /* 隐藏 ▶/❚❚ 字符 */
  position: relative;
  animation: ap-pulse 1.1s ease-in-out infinite;
}
.ap.is-loading .ap-btn::after,
.ap.is-buffering .ap-btn::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ap-spin .75s linear infinite;
}
/* 缓冲时进度条轻微呼吸，进一步提示"在等数据" */
.ap.is-loading .ap-fill,
.ap.is-buffering .ap-fill { animation: ap-pulse 1.1s ease-in-out infinite; }
.ap.is-buffering .ap-track { cursor: default; }

@keyframes ap-spin { to { transform: rotate(360deg); } }
@keyframes ap-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* 尊重系统"减少动态效果"偏好：不转圈，但仍用文字提示（见 JS 的"缓冲中…"） */
@media (prefers-reduced-motion: reduce) {
  .ap.is-loading .ap-btn,
  .ap.is-buffering .ap-btn,
  .ap.is-loading .ap-fill,
  .ap.is-buffering .ap-fill { animation: none; }
  .ap.is-loading .ap-btn::after,
  .ap.is-buffering .ap-btn::after { animation: none; border-top-color: rgba(255,255,255,.75); }
}
