/* ================= 设计变量 ================= */
:root {
  --green-700: #17854a;
  --green-600: #21a05a;
  --green-500: #2fb268;
  --green-200: #b8e6c9;
  --green-100: #e7f7ee;
  --green-050: #f3fbf6;

  --blue-700: #2276bf;
  --blue-600: #2f88d8;
  --blue-500: #4a9ae6;
  --blue-100: #e9f3fd;
  --blue-050: #f4f9ff;

  --orange-600: #e07f18;
  --orange-500: #f08a24;
  --orange-100: #fdf1e2;

  --red-800: #6d1a20;
  --red-700: #8a2029;
  --red-600: #a52a33;
  --red-100: #fdeceb;

  --ink-900: #1b1f1c;
  --ink-700: #3c423d;
  --ink-500: #6d746e;
  --ink-400: #909690;

  --line: #efefec;
  --line-strong: #e3e5e0;
  --canvas: #f5f6f3;
  --surface: #fff;
  --cream: #fdf7e8;
  --cream-line: #f3e3bd;
  /* 头部渐变两档（原站首页参考图 479×333 逐行取色：顶 #C8E9BE、中段 #DCECD5）；
     淡到 --canvas 收口，是为了和下方卡片区同底色，不留一条横向接缝 */
  --hero-top: #c8e9be;
  --hero-mid: #dcecd5;
  --hero-bg: linear-gradient(180deg, var(--hero-top) 0%, var(--hero-mid) 46%, var(--canvas) 100%);

  --radius-lg: 14px;
  --radius-md: 11px;
  --radius-sm: 8px;

  --shadow-card: 0 1px 2px rgba(24, 30, 25, 0.04), 0 4px 14px rgba(24, 30, 25, 0.045);
  --shadow-float: 0 8px 22px rgba(23, 133, 74, 0.28);

  --tabbar-h: 58px;
  --nav-h: 46px;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: #e9ebe6;
  color: var(--ink-900);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

img { display: block; max-width: 100%; }
svg { display: block; flex: none; width: 1.1em; height: 1.1em; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
input, textarea, select { font: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: #b3b8b2; }

/* ================= 外壳 ================= */
.app {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--canvas);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(24, 30, 25, 0.04), 0 20px 60px rgba(24, 30, 25, 0.1);
}

@media (min-width: 460px) {
  body { padding: 24px 0 36px; }
  .app { min-height: calc(100vh - 60px); border-radius: 24px; }
}

.page {
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + 46px + env(safe-area-inset-bottom, 0px));
  animation: pageIn 0.2s ease;
}
.page--detail { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
.page--plain { padding-bottom: 24px; }
/* 底部菜单显示出来的页面（登录页与「我的」各子页这类 .page--plain）末尾要让出它的高度，
   否则最后一条内容正好被吸底的菜单盖住。自己带底栏的页面不会加这个类，维持原来的留白。 */
body.has-tabbar .page--plain {
  padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom, 0px));
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* ================= 顶部栏 ================= */
.navbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--nav-h);
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.navbar--float {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  background: transparent;
  border-bottom-color: transparent;
  color: #fff;
}
.navbar__back {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: inherit;
}
.navbar__back:active { background: rgba(0, 0, 0, 0.06); }
.navbar__back svg { width: 21px; height: 21px; }
.navbar__title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.navbar__side {
  min-width: 32px;
  display: flex;
  justify-content: flex-end;
}
.navbar__action {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.navbar__action svg { width: 20px; height: 20px; }

/* ================= 底部 TabBar ================= */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
@media (min-width: 460px) {
  .tabbar { border-radius: 0 0 24px 24px; }
}

.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #9aa19b;
  font-size: 10.5px;
  letter-spacing: 0.2px;
}
.tabbar__item svg { width: 23px; height: 23px; }
.tabbar__item.is-active { color: var(--green-600); }
.tabbar__item.is-active .tabbar__label { font-weight: 600; }

.publish-fab {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom, 0px));
  z-index: 39;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 40px;
  padding: 0 20px;
  border-radius: 20px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, #2fb268, #17904e);
  box-shadow: 0 8px 20px rgba(23, 144, 78, 0.32);
  white-space: nowrap;
}
.publish-fab svg { width: 18px; height: 18px; }
.publish-fab:active { transform: translateX(-50%) scale(0.97); }

/* ================= 通用组件 ================= */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11px;
  color: var(--green-700);
  background: var(--green-100);
  white-space: nowrap;
}
.chip--blue { color: var(--blue-700); background: var(--blue-100); }
.chip--orange { color: var(--orange-600); background: var(--orange-100); }
.chip--grey { color: var(--ink-500); background: #f1f2ef; }
.chip--line {
  color: var(--ink-500);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
}
.avatar--sm { width: 28px; height: 28px; font-size: 12px; }
.avatar--md { width: 46px; height: 46px; font-size: 17px; }
.avatar--lg { width: 58px; height: 58px; font-size: 22px; }
.avatar--xl { width: 66px; height: 66px; font-size: 25px; }
.avatar--img { background: #e8efe6; }
.avatar--img img { width: 100%; height: 100%; object-fit: cover; }

.tone-1 { background: linear-gradient(140deg, #4c8b5f, #21603d); }
.tone-2 { background: linear-gradient(140deg, #b8762a, #8a4f14); }
.tone-3 { background: linear-gradient(140deg, #3f7c8c, #21545f); }
.tone-4 { background: linear-gradient(140deg, #6a6f9c, #424673); }
.tone-5 { background: linear-gradient(140deg, #8c6f3f, #5d4622); }
.tone-6 { background: linear-gradient(140deg, #7a5b8c, #4c3358); }
.tone-7 { background: linear-gradient(140deg, #4f7f6b, #2a5044); }
.tone-8 { background: linear-gradient(140deg, #5b6f8c, #33415a); }

.photo {
  position: relative;
  overflow: hidden;
  background-color: #e9ece6;
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo::after {
  content: attr(data-label);
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 12px 7px 5px;
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.88);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.3));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.photo--img::after { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 36px;
  padding: 0 16px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn--green { color: #fff; background: var(--green-600); }
.btn--blue { color: #fff; background: var(--blue-600); }
.btn--red { color: #fff; background: linear-gradient(135deg, #b3333c, #8a2029); }
.btn--ghost { color: var(--ink-700); box-shadow: inset 0 0 0 1px var(--line-strong); background: #fff; }
.btn--light-blue { color: var(--blue-600); background: var(--blue-100); }
.btn--block { width: 100%; }
.btn:active { filter: brightness(0.96); }

.section { margin-top: 14px; }
.section__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  margin-bottom: 9px;
}
.section__title {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.1px;
}
.section__sub { font-size: 11.5px; color: var(--ink-400); }
.section__more {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: 11.5px;
  color: var(--ink-400);
}
.section__more svg { width: 13px; height: 13px; }

.empty {
  padding: 44px 24px;
  text-align: center;
  color: var(--ink-400);
  font-size: 13px;
}
.empty__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #f1f3ef;
  color: #b9c0b8;
}
.empty__icon svg { width: 30px; height: 30px; }
.empty__title { font-size: 14.5px; font-weight: 600; color: var(--ink-700); }
.empty__desc { margin-top: 5px; font-size: 12.5px; color: var(--ink-400); line-height: 1.6; }

/* ================= 群聊横幅 ================= */
.group-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: var(--cream);
  border: 1px solid var(--cream-line);
}
.group-banner__icon {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(140deg, #34a865, #1e8a4d);
}
.group-banner__icon svg { width: 22px; height: 22px; }
.group-banner__dot {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: #e5433a;
  color: #fff;
  font-size: 9px;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--cream);
}
.group-banner__body { flex: 1; min-width: 0; }
/* 横幅的群名/简介现在取自后台 fa_nonghuo_group，长度由运营决定，一律允许折行，不用省略号吞字 */
.group-banner__title {
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.4;
  color: #7a5312;
  overflow-wrap: anywhere;
}
.group-banner__sub {
  margin-top: 1px;
  font-size: 11px;
  line-height: 1.5;
  color: #a3834f;
  overflow-wrap: anywhere;
}
.group-banner__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex: none;
  height: 29px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--blue-600);
}

/* ================= 广告位（版式见后台 fa_nonghuo_ad_position，内容见 fa_nonghuo_ad，渲染见 views/ads.js） =================
   后台一个位置没加、或那一格被关掉时，JS 直接返回空串，这一节一条规则都用不上——不存在「空广告占一行」。
   间距与列数都不写在这里：每个位置自己一行（内联 gap + is-cols-N 类），由 ads.js 按接口下发的版式给。 */
.ad-grid {
  display: grid;
  margin: 10px 12px 0;
  /* 列数只能用字面量类：repeat() 不认 var()，写成 repeat(var(--ad-cols), 1fr)
     整条 grid-template-columns 会被静默丢掉，表现是「后台选一行 3 张，前台还是竖着排」 */
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ad-grid.is-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.ad-grid.is-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ad-grid.is-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* 车队详情同级卡片（.fd-card）左右是 10px，广告跟着它，别比上下卡片宽出一截 */
.ad-grid.ad-slot--fd { margin-left: 10px; margin-right: 10px; }
.ad-tile {
  position: relative;
  display: block;
  aspect-ratio: 2 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--canvas);
}
/* 等比裁切：尺寸不符也只裁两头，不变形、不留白 */
.ad-tile__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* 首页轮播：一次一张、横向吸附滑动；只有一条时 JS 不画指示点也不自动播。
   轨道不能留 gap——吸附位是「视口宽的整数倍」，加了间距每张就会错开一个间距的量。
   自动切换用 scrollLeft 赋值（老内核不认 scrollTo 的对象参数，会静默不滚），
   平滑与否交给这里的 scroll-behavior；系统关了动效就退回瞬时切换，内容照切、动画没有。 */
.ad-carousel { position: relative; margin: 10px 12px 0; }
.ad-carousel__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
@media (prefers-reduced-motion: reduce) {
  .ad-carousel__track { scroll-behavior: auto; }
}
.ad-carousel__track::-webkit-scrollbar { display: none; }
.ad-carousel__item {
  flex: 0 0 100%;
  scroll-snap-align: center;
}
.ad-carousel__item .ad-tile { aspect-ratio: 15 / 7; border-radius: var(--radius-lg); }
/* 铺满式大图：字压在图左下，底下压一层黑色渐变保证白字在任何图上都读得清 */
.ad-tile--cover .ad-tile__img { position: absolute; inset: 0; }
.ad-tile--cover::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .45) 100%);
  pointer-events: none;
}
.ad-tile__text {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ad-tile__text b {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.ad-tile__text i {
  font-size: 12px;
  font-style: normal;
  line-height: 1.3;
  color: rgba(255, 255, 255, .86);
}
/* 指示点叠在图底部居中：当前点是长条 pill，其余是小圆点；能点，点哪个跳哪张 */
.ad-carousel__dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 5px;
}
.ad-carousel__dots button {
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  line-height: 0;
  cursor: pointer;
}
.ad-carousel__dots i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
}
.ad-carousel__dots button.is-on i {
  width: 16px;
  border-radius: 3px;
  background: #fff;
}

/* ================= 筛选条 ================= */
.tabline {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 11px 14px 10px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.tabline__item {
  position: relative;
  font-size: 16px;
  color: #8a919c;
  padding-bottom: 5px;
}
.tabline__item.is-active {
  color: #141414;
  font-weight: 680;
}
.tabline__item.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 20px;
  height: 3px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: #2f6fd6;
}
.tabline__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tabline__pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 30px;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 13.5px;
  color: #3d444e;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e2e7ee;
}
.tabline__pill svg { width: 13px; height: 13px; opacity: 0.7; }
.tabline__pill.is-active {
  color: #2f6fd6;
  background: #fff;
  box-shadow: inset 0 0 0 1px #2f6fd6;
}
.tabline__pill.is-active svg { opacity: 1; }

/* ================= 底部操作条 ================= */
.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding: 9px 12px calc(9px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.action-bar__icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 44px;
  flex: none;
  font-size: 9.5px;
  color: var(--ink-500);
}
.action-bar__icon svg { width: 21px; height: 21px; }
.action-bar__main {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 620;
  color: #fff;
  background: linear-gradient(135deg, #3a97e2, #2f88d8);
}
.action-bar__main svg { width: 17px; height: 17px; }
.action-bar__side {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--blue-700);
  background: var(--blue-100);
}
.action-bar__side svg { width: 17px; height: 17px; }

/* ================= 底部面板 ================= */
.mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(18, 22, 18, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.mask.is-open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  background: #f6f7f4;
  border-radius: 18px 18px 0 0;
  transform: translateY(103%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
.sheet.is-open { transform: none; }
.sheet__handle {
  width: 34px;
  height: 4px;
  margin: 8px auto 2px;
  border-radius: 2px;
  background: #d6dad3;
  flex: none;
}
.sheet__head {
  flex: none;
  padding: 8px 18px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.sheet__title { font-size: 16px; font-weight: 680; }
.sheet__sub { margin-top: 3px; font-size: 12px; color: var(--ink-400); }
.sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 16px;
  -webkit-overflow-scrolling: touch;
}
.sheet__foot {
  flex: none;
  display: flex;
  gap: 10px;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid var(--line);
}
.sheet__foot .btn { flex: 1; height: 42px; font-size: 15px; }

/* ================= Toast ================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 118px;
  z-index: 80;
  transform: translate(-50%, 8px);
  max-width: 80vw;
  padding: 9px 15px;
  border-radius: 9px;
  background: rgba(22, 27, 23, 0.88);
  color: #fff;
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s ease;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
