:root {
  --primary: #1485ee;
  --primary-dark: #0f6fd0;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2d3d;
  --muted: #8492a6;
  --border: #e8ecf1;
  --danger: #e64340;
  --warn: #ff976a;
  --ok: #07c160;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100%; position: relative; padding-bottom: 60px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(135deg, #1f8ff5, #0f6fd0);
  color: #fff; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar .title { font-size: 17px; font-weight: 600; }
.topbar .sub { font-size: 11px; opacity: .85; margin-top: 2px; }
.topbar .user { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; font-size: 14px; color: #fff;
}

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; background: #fff; border-top: 1px solid var(--border);
  display: flex; z-index: 10; padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .tab {
  flex: 1; text-align: center; padding: 8px 0 10px; font-size: 11px; color: var(--muted); cursor: pointer;
}
.tabbar .tab .ico { font-size: 20px; display: block; margin-bottom: 2px; }
.tabbar .tab.active { color: var(--primary); font-weight: 600; }

/* ---------- 通用 ---------- */
.page { padding: 12px; }
.card { background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(31,45,61,.05); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; }
.chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 16px; background: #fff; color: var(--muted);
  font-size: 13px; border: 1px solid var(--border); cursor: pointer;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.tag-role { background: #eef4ff; color: var(--primary); margin-right: 4px; padding: 1px 6px; border-radius: 3px; font-size: 11px; display: inline-block; margin-bottom: 2px; }
.btn {
  display: block; width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: var(--primary); color: #fff; font-size: 15px; cursor: pointer; text-align: center;
}
.btn:active { opacity: .85; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn.sm { width: auto; padding: 7px 16px; font-size: 13px; border-radius: 8px; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1; }
.fab {
  position: fixed;
  right: 16px;
  right: max(16px, calc(50% - 264px));
  bottom: 78px;
  height: 46px; padding: 0 20px; border-radius: 23px;
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  box-shadow: 0 4px 14px rgba(20,133,238,.42); cursor: pointer; z-index: 9; border: none;
  font-family: inherit;
}
.fab:active { background: var(--primary-dark); transform: scale(.97); }
.empty { text-align: center; color: var(--muted); padding: 50px 0; font-size: 14px; }
.empty .ico { font-size: 40px; display: block; margin-bottom: 10px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; background: #fff; color: var(--text); outline: none; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { min-height: 90px; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks .ck {
  padding: 6px 12px; border-radius: 6px; background: #f2f5f9; color: var(--muted); font-size: 13px; cursor: pointer; border: 1px solid transparent;
}
.checks .ck.on { background: #e8f3ff; color: var(--primary); border-color: var(--primary); }

/* ---------- 项目卡片 ---------- */
.pcard { background: #fff; border-radius: 12px; padding: 13px 14px; margin-bottom: 10px; cursor: pointer; box-shadow: 0 1px 3px rgba(31,45,61,.05); }
.pcard .row1 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pcard .pid { font-size: 12px; color: var(--muted); }
.pcard .ptitle { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.pcard .meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- 详情 ---------- */
.dhead { background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.dhead h2 { font-size: 18px; margin: 4px 0 8px; }
.dhead .desc { font-size: 14px; color: var(--muted); line-height: 1.6; white-space: pre-wrap; }
.kv { display: flex; padding: 9px 0; border-bottom: 1px solid #f2f5f9; font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { width: 92px; color: var(--muted); flex-shrink: 0; }
.kv .v { flex: 1; word-break: break-all; }
.timeline { padding-left: 6px; }
.tl-item { position: relative; padding: 0 0 16px 20px; border-left: 2px solid #e8ecf1; }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 4px; }
.tl-item::before {
  content: ''; position: absolute; left: -6px; top: 2px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary);
}
.tl-item .t { font-size: 11px; color: var(--muted); }
.tl-item .a { font-size: 14px; font-weight: 500; margin: 2px 0; }
.tl-item .n { font-size: 13px; color: var(--muted); }

/* ---------- 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat-box { background: #fff; border-radius: 12px; padding: 14px; text-align: center; }
.stat-box .num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-box .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.bar-row .bl { width: 84px; color: var(--muted); text-align: right; flex-shrink: 0; }
.bar-row .btrack { flex: 1; height: 14px; background: #f2f5f9; border-radius: 7px; overflow: hidden; }
.bar-row .bfill { height: 100%; border-radius: 7px; background: var(--primary); min-width: 4px; }
.bar-row .bn { width: 26px; text-align: right; }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 30px; }
.login .logo { text-align: center; font-size: 44px; margin-bottom: 12px; }
.login h1 { text-align: center; font-size: 20px; margin-bottom: 6px; }
.login .tip { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.member-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.member-cell { background: #fff; border-radius: 12px; padding: 14px 6px; text-align: center; cursor: pointer; box-shadow: 0 1px 3px rgba(31,45,61,.06); }
.member-cell:active { background: #e8f3ff; }
.member-cell .av { width: 42px; height: 42px; margin: 0 auto 8px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.member-cell .nm { font-size: 13px; font-weight: 600; }
.member-cell .rl { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ---------- 状态色 ---------- */
.st-pending_assign { background: #fff4e6; color: #fa8c16; }
.st-pending_confirm { background: #e8f3ff; color: #1485ee; }
.st-designing { background: #e6fffb; color: #13c2c2; }
.st-pending_review { background: #f4ecff; color: #8b5cf6; }
.st-purchasing { background: #eef7ff; color: #2f86d6; }
.st-done { background: #e8fbe9; color: #07c160; }
.overdue-tag { background: #ffece8; color: var(--danger); }

/* ---------- 弹层 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 480px; max-height: 82vh; overflow-y: auto; padding: 20px; }
.modal h3 { font-size: 16px; margin-bottom: 14px; }
.toast {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.75); color: #fff;
  padding: 10px 20px; border-radius: 8px; font-size: 14px; z-index: 30; max-width: 80%; text-align: center;
}
.link { color: var(--primary); cursor: pointer; }
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid #f2f5f9; font-size: 14px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 6px 0 0; }
.section-title { font-size: 13px; color: var(--muted); margin: 16px 2px 8px; font-weight: 600; }
