/* ============================================================
   零工市场小程序原型 · 基础组件（UI 规范 v4.1）
   按钮一律胶囊 · 静态卡片无阴影（1px 边框）· 间距全 4 倍数
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-1);
  background: var(--n-200);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.tnum { font-variant-numeric: tabular-nums; }

/* ── 手机外框 ─────────────────────────────── */
.phone {
  width: 100%;
  max-width: 414px;
  min-height: 100vh;
  background: var(--bg-page);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ── 状态栏 + 导航栏 ───────────────────────── */
.statusbar {
  height: 24px;
  background: var(--brand-500);
  flex: none;
}
.navbar {
  height: 48px;
  background: var(--brand-500);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 var(--pad-page);
  gap: var(--sp-2);
  flex: none;
  position: sticky;
  top: 0;
  z-index: 50;
}
.navbar .nav-back {
  width: 32px;
  height: 32px;
  margin-left: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  flex: none;
}
.navbar .nav-title {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.navbar .nav-title.left { text-align: left; }
.navbar .nav-right {
  width: 56px;
  flex: none;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-caption);
  color: #fff;
  cursor: pointer;
}
/* 白底导航页 */
.navbar.plain { background: var(--bg-surface); color: var(--text-1); border-bottom: 1px solid var(--line); }
.navbar.plain .nav-back, .navbar.plain .nav-right { color: var(--text-1); }

/* 微信胶囊占位 */
.wx-capsule {
  width: 76px;
  height: 28px;
  border: 1px solid var(--brand-300);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: space-around;
  color: #fff;
  font-size: 13px;
  letter-spacing: 1px;
}

/* ── 页面主体 ─────────────────────────────── */
.page-body { flex: 1; padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-4)); }
.page-body.no-tab { padding-bottom: calc(72px + var(--safe-bottom)); }

.section { padding: var(--sp-4) var(--pad-page) 0; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.section-title h2 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 600; }
.section-title .more {
  font-size: var(--fs-caption);
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}

/* ── 卡片（静态：白底 + 1px 边框，无阴影）──────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--pad-card);
}
.card + .card { margin-top: var(--sp-3); }

/* ── 按钮（一律胶囊，按下 scale .97）────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: var(--h-control);
  padding: 0 var(--sp-6);
  border-radius: var(--r-full);
  border: none;
  font-size: var(--fs-body);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand-500); color: #fff; }
.btn.primary:active { background: var(--brand-600); }
.btn.secondary { background: var(--bg-surface); color: var(--brand-700); border: 1px solid var(--brand-500); }
.btn.soft { background: var(--brand-50); color: var(--brand-700); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-soft { background: var(--danger-bg); color: var(--danger); }
.btn.text { background: transparent; color: var(--brand-700); height: auto; padding: var(--sp-1) var(--sp-2); }
.btn.block { width: 100%; }
.btn.sm { height: var(--h-control-sm); font-size: 13px; padding: 0 var(--sp-4); }
.btn.disabled, .btn[disabled] { opacity: .45; pointer-events: none; }

/* 底部通栏主按钮区（每页最多 1 个主按钮） */
.action-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 414px;
  background: var(--bg-surface);
  border-top: 1px solid var(--line);
  padding: var(--sp-3) var(--pad-page) calc(var(--sp-3) + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  z-index: 60;
}
.action-bar .side-ops { display: flex; gap: var(--sp-4); padding: 0 var(--sp-2); }
.action-bar .side-op {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-2);
  cursor: pointer;
  min-width: 40px;
}
.action-bar .side-op svg { color: var(--text-2); }
.action-bar .btn { flex: 1; }

/* ── Tab 栏 ──────────────────────────────── */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 414px;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-surface);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 60;
}
.tabbar .tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-3);
  text-decoration: none;
  cursor: pointer;
}
.tabbar .tab-item.active { color: var(--brand-500); font-weight: 600; }
.tabbar .tab-item.mid { position: relative; }
.tabbar .tab-publish {
  width: 48px;
  height: 48px;
  margin-top: -20px;
  border-radius: 50%;
  background: var(--brand-500);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  border: 4px solid var(--bg-surface);
  box-sizing: content-box;
  cursor: pointer;
}

/* ── 列表行 ─────────────────────────────── */
.cell {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 52px;
  padding: var(--sp-3) var(--pad-card);
  background: var(--bg-surface);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.cell .cell-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--brand-50);
  color: var(--brand-500);
}
.cell .cell-body { flex: 1; min-width: 0; }
.cell .cell-title { font-size: var(--fs-body); font-weight: 500; }
.cell .cell-desc { font-size: var(--fs-caption); color: var(--text-3); margin-top: 2px; }
.cell .cell-extra { font-size: var(--fs-caption); color: var(--text-3); flex: none; display: flex; align-items: center; gap: var(--sp-1); }
.cell-group { border-radius: var(--r-md); border: 1px solid var(--line); overflow: hidden; background: var(--bg-surface); }
.cell-group .cell + .cell { border-top: 1px solid var(--line); }

/* ── 表单 ──────────────────────────────── */
.form { background: var(--bg-surface); border-radius: var(--r-md); border: 1px solid var(--line); padding: var(--sp-2) var(--pad-card); }
.form-item { padding: var(--sp-3) 0; }
.form-item + .form-item { border-top: 1px solid var(--line); }
.form-label { font-size: var(--fs-body); font-weight: 500; margin-bottom: var(--sp-2); display: flex; align-items: center; gap: var(--sp-1); }
.form-label .req { color: var(--danger); }
.form-input, .form-textarea, .form-picker {
  width: 100%;
  min-height: var(--h-control);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 0 var(--sp-3);
  font-size: var(--fs-body);
  font-family: inherit;
  color: var(--text-1);
  background: var(--bg-surface);
  outline: none;
  display: flex;
  align-items: center;
}
.form-textarea { padding: var(--sp-3); min-height: 96px; resize: none; line-height: var(--lh-body); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-4); }
.form-input:focus, .form-textarea:focus, .form-picker:focus { border-color: var(--brand-500); box-shadow: var(--sh-focus); }
.form-picker { justify-content: space-between; color: var(--text-3); cursor: pointer; }
.form-picker .ph { color: var(--text-4); }
.form-error { font-size: var(--fs-caption); color: var(--danger); margin-top: var(--sp-1); display: flex; align-items: center; gap: 4px; }
.form-tip { font-size: var(--fs-caption); color: var(--text-3); margin-top: var(--sp-1); }

/* 上传 */
.uploader {
  width: 88px;
  height: 88px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  color: var(--text-3);
  font-size: var(--fs-caption);
  cursor: pointer;
  background: var(--bg-surface);
}

/* ── 标签 / 徽章 ───────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px var(--sp-2);
  border-radius: var(--r-xs);
  font-size: 11px;
  line-height: 18px;
  white-space: nowrap;
}
.tag.brand { background: var(--brand-50); color: var(--brand-700); }
.tag.gray { background: var(--bg-subtle); color: var(--text-2); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.danger { background: var(--danger-bg); color: var(--danger); }
.tag.info { background: var(--info-bg); color: var(--info); }
.tag.outline { border: 1px solid var(--brand-300); color: var(--brand-700); background: transparent; }

/* ── 排序/筛选 Tab 条 ───────────────────────── */
.sort-bar {
  position: sticky;
  top: 48px;
  z-index: 40;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 var(--pad-page);
  height: 44px;
  gap: var(--sp-5);
}
.sort-bar .sort-item { font-size: 14px; color: var(--text-2); cursor: pointer; display: flex; align-items: center; gap: 2px; height: 100%; border-bottom: 2px solid transparent; }
.sort-bar .sort-item.active { color: var(--brand-500); font-weight: 600; border-bottom-color: var(--brand-500); }
.sort-bar .sort-filter {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
}

/* ── 分段控制（互斥 ≤4 项）────────────────────── */
.segmented {
  display: flex;
  background: var(--bg-subtle);
  border-radius: var(--r-full);
  padding: 3px;
  gap: 3px;
}
.segmented .seg-item {
  flex: 1;
  text-align: center;
  padding: 7px 0;
  font-size: 14px;
  color: var(--text-2);
  border-radius: var(--r-full);
  cursor: pointer;
  white-space: nowrap;
}
.segmented .seg-item.active { background: var(--bg-surface); color: var(--text-1); font-weight: 600; box-shadow: var(--sh-1); }

/* ── 宫格菜单 ─────────────────────────────── */
.grid-menu { display: grid; gap: var(--sp-3); }
.grid-menu.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-menu.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-menu .grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--text-1);
  cursor: pointer;
  text-decoration: none;
}
.grid-menu .grid-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-50);
  color: var(--brand-500);
}
.grid-menu .grid-icon.green { background: var(--ok-bg); color: var(--ok); }
.grid-menu .grid-icon.blue { background: var(--info-bg); color: var(--info); }
.grid-menu .grid-icon.orange { background: var(--warn-bg); color: var(--warn); }

/* ── 空状态 ─────────────────────────────── */
.empty { padding: var(--sp-12) var(--pad-page); text-align: center; color: var(--text-3); font-size: 13px; }
.empty .empty-icon { margin: 0 auto var(--sp-3); color: var(--n-300); display: flex; justify-content: center; }
.empty .empty-action { margin-top: var(--sp-4); }

/* ── 头像 ─────────────────────────────── */
.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  flex: none;
}
.avatar.sm { width: 40px; height: 40px; font-size: 15px; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }

/* ── 徽点 ─────────────────────────────── */
.dot-badge { position: relative; }
.dot-badge::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid var(--bg-surface);
}

/* ── 通用工具 ─────────────────────────────── */
.row { display: flex; align-items: center; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); }
.flex-1 { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.muted { color: var(--text-3); }
.caption { font-size: var(--fs-caption); color: var(--text-3); line-height: var(--lh-caption); }
.price { color: var(--brand-500); font-weight: 600; font-size: 18px; }
.price small { font-size: 12px; font-weight: 400; }
.divider { height: 1px; background: var(--line); margin: var(--sp-3) 0; }
