:root {
  --orange: #FF7D29;
  --orange-soft: #FFF1E6;
  --green: #34A853;
  --green-soft: #E8F6EC;
  --ink: #1F2329;
  --ink-2: #4E5969;
  --ink-3: #86909C;
  --line: #EDEEF0;
  --bg: #F6F7F9;
  --white: #FFFFFF;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(31, 35, 41, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  max-width: 100%;
  overflow-x: hidden;
}
body.large-font { font-size: 19px; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  overflow: hidden;
}
@media (min-width: 900px) {
  body { background: #EEF0F3; }
  .app { box-shadow: 0 0 40px rgba(0,0,0,.08); min-height: 100vh; }
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-top, 0px)) 14px;
}
.topbar-inner { display: flex; align-items: center; gap: 10px; }
.region-btn {
  display: inline-flex; align-items: center; gap: 2px;
  border: 0; background: transparent; color: var(--ink);
  font-size: .95rem; font-weight: 600; padding: 6px 2px;
  max-width: 40%;
  overflow: hidden; white-space: nowrap;
}
.search-box {
  flex: 1;
  display: flex; align-items: center; gap: 6px;
  background: #F3F4F6; color: var(--ink-3);
  border-radius: 999px; padding: 9px 14px;
  font-size: .85rem;
  overflow: hidden; white-space: nowrap;
}

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-around;
  height: calc(58px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  z-index: 40;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: .72rem; color: var(--ink-3); position: relative; padding-top: 6px;
}
.tab.active { color: var(--orange); font-weight: 600; }
.tab-publish { flex: 0 0 74px; }
.publish-btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, #FF9B4A, var(--orange));
  color: #fff; font-size: 30px; line-height: 52px; text-align: center;
  box-shadow: 0 6px 16px rgba(255,125,41,.4);
  margin-top: -18px; font-weight: 300;
}
.badge {
  position: absolute; top: 2px; right: 50%; transform: translateX(22px);
  min-width: 16px; height: 16px; line-height: 16px;
  background: #F53F3F; color: #fff; border-radius: 9px;
  font-size: 11px; font-style: normal; text-align: center; padding: 0 4px;
}

.main { padding-bottom: calc(76px + var(--safe-bottom)); min-height: 60vh; }

/* ---------- 通用块 ---------- */
.section { margin: 12px 14px; }
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .92rem; font-weight: 600; color: var(--ink); margin: 18px 14px 8px;
}
.section-title .more { font-size: .78rem; color: var(--ink-3); font-weight: 400; }
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px;
}
.card + .card { margin-top: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }

.tag {
  display: inline-block; font-size: .7rem; line-height: 1.5;
  padding: 1px 8px; border-radius: 6px; margin-right: 4px;
}
.tag-free { background: var(--green-soft); color: var(--green); }
.tag-paid { background: #FFF3E6; color: #E06A14; }
.tag-urgent { background: #FFECE8; color: #F53F3F; }
.tag-skill { background: #EEF2FF; color: #4E5AE8; }
.tag-gray { background: #F2F3F5; color: var(--ink-3); }
.tag-help { background: #E8F6EC; color: var(--green); }

.muted { color: var(--ink-3); font-size: .78rem; }
.strong { font-weight: 600; }
.price { color: #E06A14; font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; border: 0; border-radius: 999px; padding: 12px 20px;
  background: var(--orange); color: #fff; font-weight: 600;
  min-height: 48px; font-size: 1rem;
}
.btn:active { transform: scale(.98); }
.btn-block { display: flex; width: 100%; }
.btn-ghost { background: var(--white); color: var(--ink-2); border: 1px solid var(--line); }
.btn-green { background: var(--green); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .82rem; font-weight: 500; }
.btn[disabled] { opacity: .5; }

/* ---------- 首页 ---------- */
.hero {
  padding: 14px;
  background: linear-gradient(160deg, #FFF3E8 0%, #FFFFFF 60%);
}
.hero-title { font-size: 1.35rem; font-weight: 700; letter-spacing: .5px; }
.hero-sub { color: var(--ink-2); font-size: .85rem; margin-top: 4px; }
.notice-bar {
  margin: 4px 14px 0; display: flex; align-items: center; gap: 8px;
  background: #FFF8E1; border-radius: 10px; padding: 9px 12px;
  color: #8A6100; font-size: .8rem;
}
.notice-bar span:last-child { flex: 1; min-width: 0; white-space: normal; line-height: 1.6; word-break: break-word; }

.grid8 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 4px;
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 8px; margin: 12px 14px;
}
.grid8 a, .grid8 button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 0; background: transparent; color: var(--ink-2); font-size: .8rem;
}
.grid8 .ico {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--orange-soft); font-size: 1.15rem;
}
.grid8 .ico.green { background: var(--green-soft); }

.filter-bar {
  display: flex; gap: 8px; padding: 4px 14px 8px; overflow-x: auto;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--white);
  color: var(--ink-2); border-radius: 999px; padding: 6px 14px; font-size: .8rem;
}
.chip.active { border-color: var(--orange); color: var(--orange); background: #FFF6EE; font-weight: 600; }

.list { margin: 0 14px; }
.item-card {
  display: block; background: var(--white); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.item-card:active { background: #FAFAFB; }
.item-head { display: flex; gap: 8px; align-items: flex-start; }
.item-title { font-size: 1rem; font-weight: 600; line-height: 1.45; }
.item-desc { color: var(--ink-2); font-size: .84rem; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; color: var(--ink-3); font-size: .74rem; }
.item-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: .76rem; color: var(--ink-3);
}
.thumb {
  width: 76px; height: 76px; border-radius: 10px; object-fit: cover;
  flex: 0 0 76px; background: #F2F3F5;
}

/* ---------- 详情 ---------- */
.detail-hero { padding: 18px 16px; background: var(--white); }
.detail-title { font-size: 1.15rem; font-weight: 700; line-height: 1.5; }
.detail-body { white-space: pre-wrap; color: var(--ink-2); font-size: .92rem; margin-top: 12px; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.gallery img { width: 100%; height: 108px; object-fit: cover; border-radius: 8px; }
.kv { display: flex; justify-content: space-between; padding: 7px 0; font-size: .85rem; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span:last-child { color: var(--ink); }
.user-line { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--orange-soft); object-fit: cover;
  display: flex; align-items: center; justify-content: center; color: var(--orange); font-weight: 700; }
.risk {
  margin: 12px 14px; padding: 10px 12px; border-radius: 10px;
  background: #FFF8E1; color: #8A6100; font-size: .78rem; line-height: 1.6;
}

/* ---------- 发布 ---------- */
.form { margin: 12px 14px; }
.field { background: var(--white); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.field label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 8px; }
.field input, .field textarea, .field select {
  width: 100%; border: 0; outline: 0; background: #F7F8FA;
  border-radius: 10px; padding: 12px; font-size: 1rem; color: var(--ink);
  font-family: inherit;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.field .hint { color: var(--ink-3); font-size: .74rem; margin-top: 6px; }
.type-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px; scrollbar-width: none; }
.type-tabs::-webkit-scrollbar { display: none; }
.type-tab {
  flex: 0 0 auto; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--white); font-size: .86rem; color: var(--ink-2);
}
.type-tab.active { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }

/* ---------- 消息 ---------- */
.session { display: flex; gap: 12px; padding: 14px; background: var(--white); border-bottom: 1px solid var(--line); }
.session .avatar { width: 46px; height: 46px; }
.session-unread { min-width: 18px; height: 18px; line-height: 18px; text-align: center;
  background: #F53F3F; color: #fff; border-radius: 9px; font-size: 11px; padding: 0 5px; }

.chat-wrap { background: var(--bg); padding: 12px; }
.bubble { max-width: 76%; padding: 10px 13px; border-radius: 14px; font-size: .9rem; line-height: 1.6; word-break: break-word; }
.bubble.me { margin-left: auto; background: var(--orange); color: #fff; border-bottom-right-radius: 4px; }
.bubble.other { background: #fff; border-bottom-left-radius: 4px; }
.bubble.sys { margin: 0 auto; background: transparent; color: var(--ink-3); font-size: .74rem; text-align: center; }
.msg-row { display: flex; margin-bottom: 10px; }
.chat-input {
  position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 12px calc(10px + var(--safe-bottom));
  background: #fff; border-top: 1px solid var(--line);
}
.chat-input input { flex: 1; border: 0; background: #F4F5F7; border-radius: 999px; padding: 12px 16px; font-size: .95rem; outline: 0; }
.chat-input button { border: 0; background: var(--orange); color: #fff; border-radius: 999px; padding: 0 20px; font-weight: 600; }

/* ---------- 我的 ---------- */
.me-head { padding: 22px 18px; background: linear-gradient(150deg, #FF8A3C, #FF7D29 60%, #F96A12); color: #fff; }
.me-head .name { font-size: 1.25rem; font-weight: 700; }
.me-head .sub { font-size: .8rem; opacity: .92; margin-top: 2px; }
.stat-row { display: flex; gap: 18px; margin-top: 14px; }
.stat-row .n { font-size: 1.2rem; font-weight: 700; }
.stat-row .l { font-size: .72rem; opacity: .9; }
.me-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: #fff;
  border-radius: var(--radius); padding: 16px 8px; margin: 12px 14px; box-shadow: var(--shadow); }
.me-grid a { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink-2); font-size: .78rem; }
.me-grid .ico { font-size: 1.2rem; }
.menu { background: #fff; border-radius: var(--radius); margin: 0 14px 12px; overflow: hidden; box-shadow: var(--shadow); }
.menu a, .menu button { display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 15px 16px; border: 0; background: #fff; font-size: .92rem; color: var(--ink);
  border-bottom: 1px solid var(--line); }
.menu > :last-child { border-bottom: 0; }
.menu .val { color: var(--ink-3); font-size: .82rem; }

/* ---------- 弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 720px; background: #fff;
  border-radius: 18px 18px 0 0; padding: 8px 0 calc(12px + var(--safe-bottom));
  max-height: 80vh; overflow-y: auto;
  animation: slideUp .18s ease-out;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: .6 } to { transform: none; opacity: 1 } }
.sheet-title { text-align: center; font-weight: 600; padding: 14px; border-bottom: 1px solid var(--line); }
.sheet-item { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.sheet-item.off { color: var(--ink-3); }

.toast {
  position: fixed; left: 50%; bottom: 20%; transform: translateX(-50%);
  background: rgba(31,35,41,.88); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: .86rem; z-index: 99; max-width: 80vw; text-align: center; line-height: 1.5;
}
.loading-full { padding: 60px 0; text-align: center; color: var(--ink-3); }
.empty { padding: 60px 20px; text-align: center; color: var(--ink-3); font-size: .86rem; }

.login-wrap { padding: 40px 24px; }
.login-wrap h1 { font-size: 1.4rem; margin: 0 0 6px; }
.login-wrap p { color: var(--ink-3); font-size: .84rem; margin: 0 0 24px; }
.login-tip { margin-top: 18px; font-size: .74rem; color: var(--ink-3); line-height: 1.8; }

/* 保证 hidden 属性始终生效（避免 .modal/.toast 等 display 规则覆盖） */
[hidden] { display: none !important; }
