:root {
  --primary: #e2231a;
  --primary-dark: #c61f17;
  --orange: #ff861b;
  --bg: #f5f7fb;
  --card: #fff;
  --text: #333;
  --text-2: #666;
  --text-3: #999;
  --border: #eee;
  --red: #ee3333;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* ========== 顶部 ========== */
.topbar {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 17px; font-weight: 600; }
.topbar a { color: #fff; text-decoration: none; font-size: 14px; }

/* ========== PC 顶部导航 ========== */
.pc-header {
  background: var(--primary);
  position: sticky; top: 0; z-index: 100;
}
.pc-header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; gap: 30px;
}
.pc-logo { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 19px; font-weight: 700; }
.pc-logo .logo-icon {
  width: 32px; height: 32px; border-radius: 8px; background: #fff;
  color: var(--primary); display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800;
}
.pc-nav { display: flex; gap: 4px; flex: 1; }
.pc-nav a {
  color: rgba(255,255,255,.85); font-size: 14px; padding: 6px 14px; border-radius: 6px;
}
.pc-nav a:hover, .pc-nav a.active { background: rgba(255,255,255,.15); color: #fff; }
.pc-user { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 13px; }
.pc-user .btn-login {
  background: #fff; color: var(--primary); border: none; padding: 7px 18px;
  border-radius: 16px; font-size: 13px; cursor: pointer;
}
.pc-user .btn-reg { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); padding: 6px 16px; border-radius: 16px; font-size: 13px; cursor: pointer; }
.pc-user a { color: #fff; }
.pc-user .u-pts { background: rgba(255,255,255,.15); padding: 4px 12px; border-radius: 14px; }

/* ========== 内容容器 ========== */
.page {
  max-width: 1200px; margin: 0 auto;
  padding: 16px 20px 60px;
  min-height: calc(100vh - 56px);
}
.mobile-page { display: block; }

/* ========== 底部导航（手机） ========== */
.tabbar {
  display: none;
}

/* ========== 卡片 ========== */
.card {
  background: var(--card); border-radius: 10px;
  padding: 16px; margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

/* ========== 首页 ========== */

/* 轮播 */
.banner-wrap { margin-bottom: 14px; }
.swiper {
  width: 100%; height: 150px; border-radius: 10px; overflow: hidden;
  position: relative; background: #e5e7eb;
}
.swiper-track { display: flex; height: 100%; transition: transform .35s; }
.swiper-item { flex-shrink: 0; width: 100%; height: 100%; }
.swiper-item img { width: 100%; height: 100%; object-fit: cover; }
.swiper-dots {
  position: absolute; bottom: 8px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 5px;
}
.swiper-dots i {
  width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.5);
  transition: width .2s;
}
.swiper-dots i.on { width: 14px; background: #fff; }

/* 分类导航 */
.cat-nav { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 14px; scrollbar-width: none; }
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav .cat {
  flex-shrink: 0; padding: 6px 16px; border-radius: 16px;
  background: #fff; font-size: 13px; color: var(--text-2); border: 1px solid var(--border);
  cursor: pointer;
}
.cat-nav .cat.active {
  background: var(--primary); color: #fff; border-color: transparent;
}

/* 任务卡片 */
.task-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.task-card {
  background: var(--card); border-radius: 10px;
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: transform .15s, box-shadow .15s;
}
.task-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.task-thumb {
  width: 100%; aspect-ratio: 1/1; border-radius: 8px;
  background: #f0f2f5; display: flex; align-items: center; justify-content: center;
  font-size: 30px; overflow: hidden;
}
.task-thumb img { width: 100%; height: 100%; object-fit: cover; }
.task-main { flex: 1; min-width: 0; }
.task-name {
  font-size: 14px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.task-tags { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.task-tags .tag {
  font-size: 11px; color: var(--text-3); background: #f5f7fa;
  padding: 1px 7px; border-radius: 3px;
}
.task-price { margin-top: 6px; font-size: 12px; color: var(--text-3); }
.task-price .p-comm { color: var(--red); font-weight: 700; font-size: 17px; }
.task-btn {
  background: var(--primary); color: #fff;
  border: none; padding: 8px 0; border-radius: 18px; font-size: 13px;
  width: 100%; text-align: center; cursor: pointer;
}
.task-btn:hover { background: var(--primary-dark); }

/* 区块标题 */
.section-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 16px; font-weight: 600; margin: 6px 0 12px;
}
.section-title::before {
  content: ''; width: 4px; height: 16px; border-radius: 2px;
  background: var(--primary);
}

/* ========== 任务详情 ========== */
.detail-top {
  display: flex; flex-direction: column; gap: 16px;
}
.detail-img {
  width: 100%; aspect-ratio: 1/1; border-radius: 10px; overflow: hidden;
  background: #f0f2f5; display: flex; align-items: center; justify-content: center; font-size: 60px;
}
.detail-img img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { flex: 1; min-width: 0; }
.detail-info .d-name { font-size: 19px; font-weight: 700; line-height: 1.5; }
.detail-info .d-meta { font-size: 13px; color: var(--text-3); margin: 8px 0; }
.detail-info .d-price { font-size: 14px; margin: 10px 0; }
.detail-info .d-price b { color: var(--red); font-size: 22px; }
.detail-info .d-range { font-size: 13px; color: var(--text-2); }

/* 表单 */
.form-item { margin-bottom: 14px; }
.form-item label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; background: #fff;
  outline: none; font-family: inherit;
}
.form-item input:focus { border-color: var(--primary); }

.btn-primary {
  width: 100%; background: var(--primary); color: #fff; border: none;
  padding: 12px; border-radius: 22px; font-size: 15px; margin-top: 6px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* ========== 状态筛选 tabs ========== */
.status-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 14px; scrollbar-width: none; }
.status-tabs::-webkit-scrollbar { display: none; }
.status-tabs .st-tab {
  flex-shrink: 0; padding: 6px 16px; border-radius: 16px; background: #fff;
  font-size: 13px; color: var(--text-2); border: 1px solid var(--border); cursor: pointer;
}
.status-tabs .st-tab.active { background: var(--primary); color: #fff; border-color: transparent; }

/* 状态标签 */
.st { font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.st-0 { background: #e6f7ff; color: #1890ff; }
.st-1 { background: #fff7e6; color: #fa8c16; }
.st-2 { background: #f6ffed; color: #52c41a; }
.st-4 { background: #fff1f0; color: #ff4d4f; }
.st-5 { background: #f9f0ff; color: #722ed1; }
.st-6 { background: #f5f5f5; color: #999; }

/* 订单行 */
.order-item .o-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-item .o-sn { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.order-item .o-progress { margin-top: 8px; }
.progress-bar {
  height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden; margin-top: 4px;
}
.progress-bar i { display: block; height: 100%; background: var(--primary); border-radius: 3px; transition: width .4s; }

.empty { text-align: center; color: var(--text-3); padding: 50px 0; font-size: 14px; }

/* ========== 个人中心 ========== */
.center-wrap { display: flex; gap: 16px; align-items: flex-start; }
.center-left { width: 200px; flex-shrink: 0; }
.center-right { flex: 1; min-width: 0; }

.user-profile {
  background: var(--primary);
  color: #fff; border-radius: 10px; padding: 20px; margin-bottom: 14px;
  display: flex; gap: 16px; align-items: center;
}
.user-profile .avatar {
  width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700;
  border: 2px solid rgba(255,255,255,.5); flex-shrink: 0;
}
.user-profile .u-name { font-size: 18px; font-weight: 600; }
.user-profile .u-id { font-size: 12px; opacity: .8; margin-top: 4px; }
.user-profile .u-pts { margin-left: auto; text-align: right; }
.user-profile .u-pts .num { font-size: 30px; font-weight: 700; }
.user-profile .u-pts .label { font-size: 12px; opacity: .85; }

.menu { background: #fff; border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.menu a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 16px; color: var(--text); border-bottom: 1px solid var(--border);
  font-size: 14px; transition: background .15s;
}
.menu a:last-child { border-bottom: none; }
.menu a:hover { background: #fafafa; }
.menu a .arrow { color: #ccc; }
.menu a .m-icon { margin-right: 8px; }

/* ========== 登录注册 ========== */
.auth-wrap {
  min-height: calc(100vh - 56px);
  display: flex; align-items: center; justify-content: center;
  padding: 30px 16px;
}
.auth-card {
  width: 100%; max-width: 380px; background: #fff;
  border-radius: 12px; padding: 36px 32px; box-shadow: 0 8px 30px rgba(0,0,0,.08);
}
.auth-logo {
  width: 60px; height: 60px; border-radius: 16px; background: var(--primary);
  color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; font-weight: 800;
}
.auth-title { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 28px; }
.auth-link { text-align: center; font-size: 13px; color: var(--text-3); margin-top: 16px; }
.auth-link a { color: var(--primary); }

/* 弹层 */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200;
  display: none; align-items: center; justify-content: center;
}
.mask.show { display: flex; }
.sheet {
  background: #fff; border-radius: 14px; width: 88%; max-width: 400px;
  padding: 20px; max-height: 80vh; overflow-y: auto;
}
.sheet h3 { font-size: 16px; margin-bottom: 14px; text-align: center; }

/* 提示 */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.75); color: #fff; padding: 12px 22px;
  border-radius: 8px; font-size: 14px; z-index: 300; display: none;
}

/* ========== 管理后台 ========== */
.admin-topbar {
  background: var(--primary); color: #fff; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.admin-topbar h1 { font-size: 17px; font-weight: 600; }
.admin-topbar a { color: #fff; font-size: 13px; }
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px; }
.admin-nav a {
  background: #fff; padding: 8px 14px; border-radius: 8px; text-decoration: none;
  color: var(--text); font-size: 13px; border: 1px solid var(--border);
}
.admin-nav a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
.admin-table th, .admin-table td { padding: 10px 12px; font-size: 13px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: #fafafa; color: #666; font-weight: 500; }
.admin-table td img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.btn-sm {
  padding: 4px 12px; border-radius: 6px; border: none; font-size: 12px; cursor: pointer;
  background: var(--primary); color: #fff;
}
.btn-sm.gray { background: #f0f0f0; color: #666; }
.btn-sm.red { background: var(--red); color: #fff; }
.row-actions { display: flex; gap: 6px; }

/* ========== 响应式：手机 <769px ========== */
@media (max-width: 768px) {
  .pc-header { display: none; }

  body { max-width: 480px; margin: 0 auto; box-shadow: 0 0 12px rgba(0,0,0,.06); }

  .topbar {
    position: sticky; top: 0; z-index: 100;
    background: var(--primary);
    padding: 13px 16px;
  }
  .topbar a { font-size: 13px; }

  /* 手机底部 tab */
  .tabbar {
    display: flex;
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 480px;
    background: #fff; border-top: 1px solid var(--border);
    z-index: 100; padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1; text-align: center; padding: 7px 0 9px;
    color: var(--text-3); font-size: 10px;
  }
  .tabbar a .icon { font-size: 21px; display: block; margin-bottom: 1px; }
  .tabbar a.active { color: var(--primary); }

  .page { padding: 12px 12px 70px; }

  .swiper { height: 130px; }
  .banner-wrap { margin: 0 -12px; padding: 0 12px 4px; }

  .task-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  .detail-img { aspect-ratio: 4/3; font-size: 44px; }

  .center-wrap { display: block; }
  .center-left { display: none; }

  .user-profile { padding: 16px; }
  .user-profile .avatar { width: 54px; height: 54px; font-size: 24px; }
  .user-profile .u-pts .num { font-size: 24px; }

  .auth-wrap { min-height: 100vh; }
}

/* ========== 响应式：平板/PC <1024 ========== */
@media (min-width: 769px) {
  .topbar { display: none; }
  .mobile-page { display: block; }
  .detail-top { flex-direction: row; }
  .detail-img { width: 340px; flex-shrink: 0; }
  .task-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .task-grid { grid-template-columns: repeat(3, 1fr); }
}
