/* ============================================================
   黎川同乡通 PWA · 样式（移动优先，无框架）
   配色取自老家的土陶与稻黄，和另外两个站点区分开
   ============================================================ */
:root {
  --brand: #c8452f;
  --brand-dark: #a8351f;
  --brand-weak: #fdeeea;
  --accent: #e8a33d;
  --bg: #f6f3ee;
  --card: #ffffff;
  --text: #23201d;
  --muted: #7a726b;
  --line: #ece5dc;
  --ok: #1f8a5b;
  --ok-weak: #e8f5ee;
  --warn: #b9751a;
  --warn-weak: #fdf3e3;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(35, 32, 29, .05), 0 6px 18px -8px rgba(35, 32, 29, .12);
  --topbar-h: 54px;
  --tabbar-h: 58px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0 0 10px; }

/* ---------- 骨架 ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }
.view { padding: 12px 14px 24px; min-height: calc(100vh - var(--topbar-h) - var(--tabbar-h)); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  background: rgba(246, 243, 238, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-title { font-size: 17px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-back, .topbar-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--text);
}
.topbar-back:active, .topbar-btn:active { background: rgba(0, 0, 0, .05); }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.topbar-ghost { color: var(--brand); font-size: 14px; padding: 6px 8px; border-radius: 8px; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  max-width: 560px; margin: 0 auto;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; color: #9c948c; cursor: pointer; border: 0; background: none;
  padding: 6px 0;
}
.tab.active { color: var(--brand); font-weight: 600; }
.tab svg { width: 23px; height: 23px; }
.tab .dot { position: absolute; }

/* ---------- 通用块 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 12px; }
.card-hd { padding: 14px 14px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-hd h3 { font-size: 16px; }
.card-bd { padding: 12px 14px 14px; }
.card-tap:active { transform: scale(.995); }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.section { margin: 18px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.section h2 { font-size: 16px; }
.section .more { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flex { display: flex; align-items: center; gap: 8px; }

/* ---------- 首页 ---------- */
.hero {
  border-radius: 18px; padding: 20px 18px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #c8452f 0%, #a8351f 62%, #8f2d1a 100%);
  box-shadow: 0 10px 26px -14px rgba(168, 53, 31, .8);
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -50px; width: 170px; height: 170px;
  border-radius: 50%; background: rgba(255, 255, 255, .09);
}
.hero::before {
  content: ""; position: absolute; right: 30px; bottom: -60px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(255, 255, 255, .06);
}
.hero h1 { font-size: 22px; letter-spacing: .5px; }
.hero p { font-size: 13px; opacity: .88; margin: 6px 0 0; }
.hero .hero-tags { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.hero .hero-tags span {
  font-size: 12px; padding: 4px 10px; border-radius: 20px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .2);
}
.entries { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.entry {
  background: var(--card); border-radius: var(--radius); padding: 12px 6px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: var(--shadow); font-size: 12px; color: var(--text); border: 0; cursor: pointer;
}
.entry:active { transform: scale(.97); }
.entry .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.entry .ico svg { width: 20px; height: 20px; }
.ico-job { background: #fdeeea; color: #c8452f; }
.ico-car { background: #e9f2fd; color: #2c6fb5; }
.ico-help { background: var(--ok-weak); color: var(--ok); }
.ico-shop { background: #fdf3e3; color: var(--warn); }

/* ---------- 列表项 ---------- */
.list { display: flex; flex-direction: column; }
.item {
  display: block; padding: 13px 14px; border-bottom: 1px solid var(--line);
  background: var(--card); cursor: pointer;
}
.item:last-child { border-bottom: 0; }
.item:active { background: #faf7f2; }
.item-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.item-title { font-size: 16px; font-weight: 600; line-height: 1.35; }
.item-desc { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.item-meta .sep { color: #d8d1c9; }

.price { color: var(--brand); font-weight: 700; font-size: 17px; white-space: nowrap; }
.price small { font-size: 11px; font-weight: 500; margin-left: 2px; }

.tag {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11px; line-height: 1;
  padding: 4px 7px; border-radius: 6px; background: #f2ede6; color: #6f675f; white-space: nowrap;
}
.tag-brand { background: var(--brand-weak); color: var(--brand); }
.tag-ok { background: var(--ok-weak); color: var(--ok); }
.tag-warn { background: var(--warn-weak); color: var(--warn); }
.tag-blue { background: #e9f2fd; color: #2c6fb5; }
.tag-gray { background: #f0ece6; color: #837a71; }

/* ---------- 徽标 / 提示条 ---------- */
.notice-bar {
  display: flex; gap: 8px; align-items: flex-start; font-size: 12px; line-height: 1.5;
  background: #fff8e8; color: #8a6216; border: 1px solid #f4e4bd;
  padding: 9px 12px; border-radius: 10px;
}
.notice-bar.danger { background: #fdeeea; border-color: #f3d3cb; color: #9c3a26; }
.notice-bar.info { background: #eff5fd; border-color: #d5e3f7; color: #2c5f96; }
.notice-bar strong { font-weight: 600; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent;
  background: #f0ece6; color: var(--text); font-size: 15px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.btn:active { opacity: .85; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 14px -8px rgba(200, 69, 47, .9); }
.btn-outline { background: #fff; border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-danger { background: #fdeeea; color: var(--danger); }
.btn-block { display: flex; width: 100%; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 48px; font-size: 16px; border-radius: 12px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.label { display: block; font-size: 13px; color: #605952; margin-bottom: 6px; font-weight: 500; }
.label .req { color: var(--brand); }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 11px;
  padding: 11px 12px; font-size: 15px; outline: none; transition: border-color .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand); }
.input::placeholder, .textarea::placeholder { color: #b3aaa2; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%237a726b' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field-err { font-size: 12px; color: var(--danger); margin-top: 5px; }
.inline-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.switch { position: relative; width: 46px; height: 27px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; z-index: 2; }
.switch i { position: absolute; inset: 0; background: #ddd6cd; border-radius: 20px; transition: .2s; }
.switch i::after { content: ""; position: absolute; width: 23px; height: 23px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(19px); }

/* ---------- 筛选 ---------- */
.filters { position: sticky; top: var(--topbar-h); z-index: 20; background: var(--bg); padding: 8px 0 6px; margin: -4px 0 8px; }
.seg { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.seg::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; height: 32px; padding: 0 13px; border-radius: 20px; border: 1px solid var(--line);
  background: #fff; color: #5c554e; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
.chip-arrow::after { content: "▾"; font-size: 10px; opacity: .7; }

/* ---------- 空态 / 骨架 ---------- */
.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty .empty-ico { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; background: #efe9e1; display: grid; place-items: center; color: #b3aaa2; }
.empty h4 { font-size: 15px; color: #5c554e; margin-bottom: 6px; }
.empty p { font-size: 13px; line-height: 1.6; }
.skeleton { background: linear-gradient(90deg, #efeae3 25%, #f6f2ec 37%, #efeae3 63%); background-size: 400% 100%; animation: sk 1.2s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-line { height: 14px; margin-bottom: 9px; }

/* ---------- 底部浮层 / 弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(20, 17, 15, .42); z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
.sheet {
  width: 100%; max-width: 560px; background: #fff; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  animation: up .22s cubic-bezier(.2, .8, .3, 1); max-height: 88vh; overflow: auto;
}
.sheet h3 { font-size: 17px; margin-bottom: 4px; }
.sheet .sheet-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.center-modal { align-items: center; padding: 20px; }
.center-modal .sheet { border-radius: 16px; max-width: 340px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }

/* ---------- toast ---------- */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom)); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: 86%; background: rgba(28, 24, 21, .92); color: #fff; font-size: 14px;
  padding: 10px 16px; border-radius: 22px; box-shadow: 0 8px 20px -8px rgba(0,0,0,.5);
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

/* ---------- 详情页 ---------- */
.detail-hd { padding: 18px 16px 14px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.detail-hd h1 { font-size: 20px; line-height: 1.4; }
.detail-hd .sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 10px 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; line-height: 1.55; }
.paragraphs { font-size: 15px; line-height: 1.85; color: #33302c; }
.paragraphs p { margin: 0 0 12px; }
.article { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 16px 8px; }
.article h1 { font-size: 20px; line-height: 1.45; margin-bottom: 10px; }
.article .meta { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.action-bar {
  position: sticky; bottom: 0; margin: 16px -14px -24px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
  display: flex; gap: 10px; backdrop-filter: blur(10px);
}
.action-bar .btn { flex: 1; }

/* ---------- 我的 ---------- */
.me-hero { display: flex; align-items: center; gap: 14px; padding: 18px 16px; }
.avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--brand-weak); color: var(--brand); display: grid; place-items: center; font-size: 20px; font-weight: 600; flex: 0 0 auto; }
.me-hero .who { flex: 1; min-width: 0; }
.me-hero .who b { font-size: 18px; display: block; }
.me-hero .who span { font-size: 12px; color: var(--muted); }
.me-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.me-stats .st { padding: 12px 0; text-align: center; }
.me-stats .st b { display: block; font-size: 17px; }
.me-stats .st span { font-size: 12px; color: var(--muted); }
.menu { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.mi {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 15px; border: 0; border-bottom: 1px solid var(--line);
  background: #fff; color: var(--text); font-size: 15px; font-family: inherit;
  text-align: left; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.mi:last-child { border-bottom: 0; }
.mi:active { background: #faf7f2; }
.mi .mi-ico { width: 26px; height: 26px; display: grid; place-items: center; color: var(--brand); flex: 0 0 auto; }
.mi .mi-ico svg { width: 19px; height: 19px; }
.mi .mi-t { flex: 1; }
.mi .mi-r { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.mi .arrow { color: #c9c1b8; font-size: 16px; }

/* ---------- 后台 ---------- */
.admin-shell { margin: -12px -14px 0; }
.admin-status { background: #fff; padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-size: 13px; position: sticky; top: var(--topbar-h); z-index: 18; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: var(--topbar-h); z-index: 17; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs .at { flex: 0 0 auto; padding: 6px 12px; border-radius: 8px; background: #f4efe8; font-size: 13px; color: #5c554e; cursor: pointer; }
.admin-tabs .at.active { background: var(--brand); color: #fff; }
.admin-panel { padding: 12px 14px 30px; }
.admin-item { background: #fff; border-radius: 12px; padding: 13px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.admin-item .ai-hd { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.admin-item .ai-hd b { font-size: 15px; }
.admin-item .ai-body { font-size: 13px; color: #5c554e; line-height: 1.65; margin: 8px 0 10px; white-space: pre-wrap; word-break: break-word; }
.admin-item .ai-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border-radius: 12px; padding: 14px; box-shadow: var(--shadow); }
.stat .n { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.hot .n { color: var(--brand); }

/* ---------- 长文 / 知识库 ---------- */
.kb-list { display: grid; gap: 10px; }
.kb-card { background: #fff; border-radius: 12px; padding: 14px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start; }
.kb-card .kb-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-weak); color: var(--brand); display: grid; place-items: center; flex: 0 0 auto; font-size: 16px; font-weight: 700; }
.kb-card b { font-size: 15px; display: block; margin-bottom: 3px; }
.kb-card span { font-size: 12px; color: var(--muted); }

/* ---------- 安装引导 ---------- */
.install-bar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 60;
  max-width: 560px; margin: 0 auto; padding: 10px 12px;
  background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 18px -14px rgba(0,0,0,.4);
  display: flex; align-items: center; gap: 10px;
}
.install-bar .ib-ico { width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto; }
.install-bar .ib-t { flex: 1; font-size: 13px; line-height: 1.4; }
.install-bar .ib-t b { display: block; font-size: 14px; }
body.has-install { padding-bottom: calc(var(--tabbar-h) + 66px + env(safe-area-inset-bottom)); }
body.has-install.no-tab { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }

/* ---------- 桌面 ---------- */
@media (min-width: 900px) {
  body { background: #eae5dd; }
  .app { box-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 20px 60px -30px rgba(0,0,0,.35); background: var(--bg); }
  .admin-shell { max-width: 760px; margin: 0 auto; }
}
@media (max-width: 360px) {
  .entries { grid-template-columns: repeat(4, 1fr); }
  .entry { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 图片选择与预览（透明 input 铺满，iOS/微信才能唤起） ---------- */
.shots { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.shot {
  width: 84px; height: 84px; border-radius: 10px; object-fit: cover;
  border: 1px solid var(--line); background: #f4efe8;
}
.shot-add {
  position: relative; width: 84px; height: 84px; border-radius: 10px;
  border: 1px dashed #d9d1c7; background: #fbf8f4; color: var(--muted);
  display: grid; place-items: center; font-size: 12px; text-align: center;
  cursor: pointer; padding: 4px;
}
.shot-add input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; font-size: 100px; cursor: pointer;
}
.mb12 { margin-bottom: 12px; }
