/* 会议签到 · H5 样式
 *
 * 设计原则：
 *   1. 移动端优先（绝大多数人从飞书手机端点进来）
 *   2. 沿用小程序版的设计语言（卡片、标签、色彩），降低认知成本
 *   3. 颜色用 CSS 变量集中管理，改主题只改这一处
 *   4. 不引入任何 UI 框架 —— 页面简单，框架反而是负担
 */

:root {
  --primary: #2f6fd0;
  --primary-dark: #1f5faa;
  --primary-light: #eef4fd;

  --green: #1e7e34;
  --green-bg: #e6f4ea;
  --red: #b3261e;
  --red-bg: #fdeaea;
  --amber: #96590a;
  --amber-bg: #fff4e0;

  --text: #222;
  --text-muted: #8a9099;
  --text-sub: #5a6472;

  --bg: #f4f5f7;
  --card: #fff;
  --border: #eceef1;

  --radius: 12px;
  --radius-sm: 8px;

  /* iOS 安全区 */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  /* 适配刘海屏 */
  padding-bottom: calc(24px + var(--safe-bottom));
}

.container { padding: 12px; max-width: 640px; margin: 0 auto; }

/* ---------- 页面导航 ----------
   之前的页面没有返回入口，用户只能"保存后才能离开"，是被明确吐槽的问题。
   sticky 让它在长页面里也一直可见。 */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 4px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  margin: -12px -12px 12px;
}
.nav-btn {
  display: flex; align-items: center; justify-content: center;
  min-width: 44px; height: 40px;      /* 44px 是可点击区域下限 */
  padding: 0 10px;
  border: none; background: none; border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; color: var(--primary);
  cursor: pointer;
}
.nav-btn:active { background: #f0f4fa; }
.nav-title { font-size: 16px; font-weight: 600; flex: 1; text-align: center; padding-right: 44px; }
.nav-action { font-size: 14px; padding-right: 0; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.card-title { font-size: 16px; font-weight: 600; line-height: 1.4; }

.muted { color: var(--text-muted); font-size: 12px; }
.hint { color: var(--text-muted); font-size: 12px; line-height: 1.5; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.spacer { flex: 1; min-width: 0; }

/* 单行截断：flex 子项必须配 min-width:0，否则内容会把容器顶开、截断失效 */
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.section-title { font-size: 15px; font-weight: 600; padding: 8px 4px; color: var(--text); }

.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 8px; border-radius: 6px; font-size: 11px; line-height: 1.5;
  background: #eef2f7; color: var(--text-sub); white-space: nowrap; flex-shrink: 0;
}
.tag.blue  { background: #e7f0fd; color: var(--primary-dark); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.red   { background: var(--red-bg); color: var(--red); }
.tag.amber { background: var(--amber-bg); color: var(--amber); }

/* ---------- 按钮 ---------- */
/* ⚠️ 不要给 .btn 之外的变体加 display:block —— 
   那会覆盖 flex，导致 justify-content:center 失效、文字靠左（小程序版踩过这个坑） */
.btn {
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius-sm);
  min-height: 44px;           /* 44px 是移动端可点击区域的下限 */
  padding: 0 16px;
  font-size: 15px; font-family: inherit; line-height: 1;
  cursor: pointer; white-space: nowrap;
  text-decoration: none;
  transition: opacity .15s;
}
.btn:active { opacity: .75; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.gray  { background: #8a9099; }
.btn.danger{ background: var(--red); }
.btn.sm    { min-height: 34px; font-size: 13px; padding: 0 12px; }

/* ---------- 表单 ---------- */
.field-label { font-size: 13px; color: var(--text-sub); padding: 12px 2px 6px; }

.field {
  width: 100%; height: 44px; padding: 0 12px;
  background: #f7f8fa; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; color: var(--text);
  -webkit-appearance: none; appearance: none;
}
.field:focus { outline: none; border-color: var(--primary); background: #fff; }

textarea.field { height: 80px; padding: 10px 12px; line-height: 1.5; resize: vertical; }

/* ---------- 勾选行 ---------- */
.check-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 8px; border-bottom: 1px solid #f0f1f3;
  cursor: pointer; user-select: none;
}
.check-row:last-child { border-bottom: none; }
.check-row.selected { background: var(--primary-light); border-radius: var(--radius-sm); }

.checkbox {
  position: relative; width: 20px; height: 20px; flex-shrink: 0;
  border: 1.5px solid #c8ccd2; border-radius: 4px; background: #fff;
  transition: background .15s, border-color .15s;
}
.checkbox.checked { background: var(--primary); border-color: var(--primary); }
.checkbox.checked::after {
  content: ''; position: absolute; left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
/* 半选：整组里只有部分人被选中 */
.checkbox.partial { background: #f0f6ff; border-color: var(--primary); }
.checkbox.partial::after {
  content: ''; position: absolute; left: 3px; top: 8px; width: 11px; height: 0;
  border-top: 2px solid var(--primary);
}

.check-title { font-size: 15px; line-height: 1.4; }
.check-row.selected .check-title { color: var(--primary-dark); font-weight: 600; }

/* ---------- 树形（分组 → 成员） ---------- */
.tree-group { border-bottom: 1px solid #f0f1f3; }
.tree-group.selected { background: var(--primary-light); border-radius: var(--radius-sm); }
.tree-group-main { display: flex; align-items: center; gap: 10px; padding: 12px 8px; cursor: pointer; }
.tree-arrow { padding: 10px; margin: -10px; flex-shrink: 0; color: var(--text-muted); font-size: 12px; }
.tree-children { padding: 0 8px 8px 34px; }
.tree-leaf {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-radius: var(--radius-sm); cursor: pointer;
}
.tree-leaf.selected { background: var(--primary-light); }
.tree-leaf.selected .check-title { color: var(--primary-dark); font-weight: 600; }

/* ---------- 结果区（先给结果，再给操作） ---------- */
.roster-summary {
  display: flex; align-items: center; justify-content: space-between;
  background: #f4f8ff; border-radius: var(--radius-sm);
  padding: 12px; margin: 8px 0; cursor: pointer;
}
.roster-num { font-size: 22px; font-weight: 600; color: var(--primary-dark); }
.roster-list { border: 1px solid #e6eefb; border-radius: var(--radius-sm); padding: 4px 12px; }

/* ---------- 统计数字 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.stat-item { text-align: center; padding: 10px 0; }
.stat-num { font-size: 20px; font-weight: 600; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: #9aa1a9; padding: 40px 20px; font-size: 13px; line-height: 1.6; }

/* ---------- 底部操作条 ---------- */
.footer-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff; border-top: 1px solid var(--border);
  padding: 10px 12px calc(10px + var(--safe-bottom));
  z-index: 20;
}
.footer-bar .container { padding: 0; }

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.78); color: #fff; padding: 10px 18px;
  border-radius: 8px; font-size: 14px; z-index: 999; max-width: 80%;
  text-align: center; line-height: 1.5;
}

/* ---------- 大号签到按钮 ---------- */
.signin-hero { text-align: center; padding: 20px 0 8px; }
.signin-hero .time { font-size: 32px; font-weight: 600; letter-spacing: 1px; }
.signin-hero .label { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

@media (prefers-color-scheme: dark) {
  /* 飞书里也有深色模式，做个基础适配，避免白底刺眼 */
  :root {
    --bg: #17181a; --card: #232427; --border: #2f3134;
    --text: #e8e9ea; --text-muted: #8a9099; --text-sub: #b8bec6;
    --primary-light: #1e2a3d;
  }
  .field { background: #2b2d30; color: var(--text); }
  .tag { background: #2b2d30; }
  .checkbox { background: #2b2d30; border-color: #4a4d52; }
  .footer-bar { background: var(--card); }
}
