/* 自家果园订货站 —— 手机优先样式（无外部依赖） */
:root {
  --bg: #f6f2ea;
  --card: #ffffff;
  --ink: #2b2620;
  --ink-2: #6f675a;
  --muted: #9a917f;
  --line: #ece5d8;
  --red: #c8402f;
  --red-deep: #a83325;
  --red-soft: #fdeeE8;
  --green: #3f8f4a;
  --green-soft: #e9f5ea;
  --amber: #a3620f;
  --amber-soft: #fcf1dc;
  --blue: #2f6db8;
  --blue-soft: #e8f0fb;
  --gray: #7a7264;
  --gray-soft: #f0ece4;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(60, 45, 20, .07);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}
body.admin { padding-bottom: 20px; background: #f3f1ec; }

.view { max-width: 560px; margin: 0 auto; padding: 12px 12px 24px; }
body.admin .view { max-width: 880px; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px; border: none; border-radius: 12px;
  background: var(--red); color: #fff; font-size: 16px; font-weight: 600;
  cursor: pointer; user-select: none; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn.green { background: var(--green); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.btn.ghost.red { color: var(--red); border-color: #f0cdb6; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1; }

.muted { color: var(--muted); font-size: 13px; }
.icp-footer { text-align: center; margin-top: 6px; font-size: 12px; }
.icp-footer a { color: var(--muted); text-decoration: none; }
.icp-footer a + a { margin-left: 12px; }
.sub { color: var(--ink-2); font-size: 13px; }
.price { color: var(--red); font-weight: 700; }
.price .rmb { font-size: .78em; }
.mt0 { margin-top: 0; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
.field input[type=text], .field input[type=tel], .field input[type=password],
.field input[type=number], .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 16px; background: #fff; color: var(--ink);
  font-family: inherit;
}
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--red); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }

/* 状态徽章 */
.chip {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.7;
}
.st-pending  { background: var(--amber-soft); color: var(--amber); }
.st-confirmed{ background: var(--blue-soft); color: var(--blue); }
.st-shipped  { background: var(--blue-soft); color: var(--blue); }
.st-completed{ background: var(--green-soft); color: var(--green); }
.st-cancelled{ background: var(--gray-soft); color: var(--gray); }

/* 底部标签栏 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; max-width: 560px; margin: 0 auto;
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 0 5px; text-decoration: none; color: var(--muted); font-size: 11px;
  position: relative;
}
.tabbar a .ico { font-size: 22px; line-height: 1.1; }
.tabbar a.active { color: var(--red); font-weight: 600; }
.tabbar .badge {
  position: absolute; top: 2px; left: calc(50% + 8px);
  background: var(--red); color: #fff; border-radius: 999px;
  font-size: 11px; line-height: 1; padding: 3px 6px; font-weight: 600;
}

/* 弹出提示 */
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%) translateY(-8px);
  background: rgba(43, 38, 32, .92); color: #fff; font-size: 14px;
  padding: 9px 16px; border-radius: 999px; z-index: 100;
  opacity: 0; pointer-events: none; transition: all .25s; max-width: 86vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(30, 25, 18, .45); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 28px;
}
.modal {
  background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 340px;
}
.modal h3 { margin: 0 0 8px; font-size: 17px; }
.modal p { margin: 0 0 16px; color: var(--ink-2); font-size: 14px; white-space: pre-line; }

/* ---------- 页面过渡 ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view > * { animation: fadeUp .22s ease both; }

/* ---------- 首页轮播 ---------- */
.carousel {
  position: relative; border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); margin-bottom: 10px; background: #efe9dc;
}
.car-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.car-track::-webkit-scrollbar { display: none; }
.car-slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; aspect-ratio: 16/9; background: linear-gradient(160deg, #fdf3e3, #f6e3bf); }
.car-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.car-dots {
  position: absolute; bottom: 10px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 6px;
}
.car-dot {
  width: 6px; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .55);
  transition: all .2s; cursor: pointer;
}
.car-dot.on { width: 16px; background: #fff; }

/* 管理端轮播图管理 */
.banner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.banner-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; }
.banner-ops { display: flex; justify-content: center; gap: 0; margin-top: 4px; flex-wrap: wrap; }
.banner-ops .del-link { font-size: 12px; padding: 3px 5px; }

/* ---------- 首页 ---------- */
.hero {
  border-radius: 16px; padding: 20px 16px 18px; margin-bottom: 10px; color: #fff;
  background: linear-gradient(135deg, #b93a2c 0%, #cf5a35 55%, #c07a2c 100%);
  box-shadow: 0 4px 14px rgba(184, 58, 44, .25); position: relative; overflow: hidden;
}
.hero h1 { margin: 0; font-size: 23px; letter-spacing: 1px; text-shadow: 0 1px 2px rgba(0,0,0,.15); }
.hero .hero-apple {
  position: absolute; right: 10px; top: 10px; font-size: 58px; opacity: .95;
  transform: rotate(14deg); filter: drop-shadow(0 4px 6px rgba(0,0,0,.18));
}
.hero-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; position: relative; z-index: 1; }
.hero-tag {
  padding: 3px 10px; border-radius: 999px; font-size: 12px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3);
}
.hero-tag.hot { background: #fff; color: var(--red); font-weight: 700; border-color: #fff; }

.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.p-card {
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.p-card:active { transform: scale(.985); }
@media (hover: hover) { .p-card:hover { box-shadow: 0 4px 14px rgba(60, 45, 20, .12); } }
.p-img { aspect-ratio: 16/10; background: linear-gradient(160deg, #fdf3e3, #f7e6c8); display: flex; align-items: center; justify-content: center; }
.p-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-img .ph { font-size: 42px; }
.p-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.p-name { font-size: 14px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-spec { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; margin-top: 2px; }
.p-price { font-size: 16px; }
.p-price .unit { font-size: 12px; color: var(--muted); font-weight: 400; }
.p-btns { display: flex; gap: 6px; margin-top: auto; padding-top: 6px; }
.add-btn, .buy-btn {
  flex: 1; min-height: 32px; border: none; border-radius: 8px;
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
  white-space: nowrap; padding: 0 2px;
}
.add-btn { background: var(--red-soft); color: var(--red); }
.buy-btn { background: var(--red); color: #fff; }
.add-btn:disabled, .buy-btn:disabled { opacity: .45; }
.stock-hint { font-size: 12px; color: var(--amber); }

/* 商品详情 */
.detail-img { aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.detail-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-ph {
  aspect-ratio: 4/3; border-radius: var(--radius); box-shadow: var(--shadow);
  background: linear-gradient(160deg, #fdf3e3, #f6e3bf);
  display: flex; align-items: center; justify-content: center; font-size: 96px;
}
.detail-name { font-size: 19px; font-weight: 700; margin: 14px 0 2px; }
.detail-desc { white-space: pre-line; font-size: 14px; color: var(--ink-2); margin: 10px 0 0; }

/* 数量步进器 */
.stepper { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper button {
  width: 38px; height: 38px; border: none; background: #fff; font-size: 18px;
  color: var(--ink); cursor: pointer;
}
.stepper button:disabled { color: #ddd; }
.stepper .num { min-width: 40px; text-align: center; font-size: 16px; font-weight: 600; }

/* 购物车 / 清单 */
.line-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: none; }
.line-item .info { flex: 1; min-width: 0; }
.line-item .nm { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-sub { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.del-link { border: none; background: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 6px; }

.footer-bar {
  position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom));
  z-index: 25; display: flex; max-width: 560px; margin: 0 auto;
  background: #fff; border-top: 1px solid var(--line); padding: 10px 14px;
  align-items: center; gap: 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.footer-bar .total { flex: 1; font-size: 17px; }
/* 底部操作条占位（手机端为固定条留出空间，桌面端隐藏改为吸底） */
.fb-space { height: 80px; }

/* 地址 */
.addr-card { display: flex; align-items: center; gap: 10px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.addr-card:last-child { border-bottom: none; }
.addr-card .info { flex: 1; min-width: 0; cursor: pointer; }
.addr-name { font-weight: 600; font-size: 15px; }
.addr-name .tel { font-weight: 400; color: var(--ink-2); font-size: 13px; margin-left: 6px; }
.addr-detail { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.tag-default { background: var(--green-soft); color: var(--green); font-size: 11px; padding: 1px 7px; border-radius: 999px; margin-left: 6px; font-weight: 600; }
.radio-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #d8d0c0; flex: none; }
.radio-dot.on { border-color: var(--red); background: radial-gradient(circle, var(--red) 0 5px, #fff 6px); }

/* 订单 */
.order-card { cursor: pointer; }
/* 管理端订单列表：紧凑卡片（3 行） */
.oc-card { padding: 9px 12px; margin-bottom: 8px; }
.oc-head { display: flex; align-items: center; gap: 8px; }
.oc-no { font-weight: 600; font-size: 13px; }
.oc-time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.oc-row2 { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 13px; }
.oc-recipient { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.oc-items {
  margin-top: 4px; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-no { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.order-time { font-size: 12px; color: var(--muted); }

/* 我的 */
.user-card { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 54px; height: 54px; border-radius: 50%; background: var(--red-soft);
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.menu-list { padding: 0; }
.menu-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 4px;
  border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink);
  font-size: 15px; cursor: pointer; background: none; border-left: none; border-right: none; border-top: none; width: 100%; font-family: inherit;
}
.menu-item:last-child { border-bottom: none; }
.menu-item .mi-ico { font-size: 20px; }
.menu-item .arrow { margin-left: auto; color: #c9c0ae; font-size: 14px; }

/* ---------- 管理端 ---------- */
.admin-top {
  display: flex; align-items: center; gap: 10px; padding: 4px 2px 12px;
}
.admin-top .back { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.admin-top h2 { margin: 0; font-size: 18px; flex: 1; }
.admin-tabs {
  display: flex; gap: 6px; background: #eae6dd; padding: 4px; border-radius: 12px; margin-bottom: 14px;
}
.admin-tabs a {
  flex: 1; text-align: center; padding: 8px 0; border-radius: 9px; text-decoration: none;
  color: var(--ink-2); font-size: 14px; font-weight: 600;
}
.admin-tabs a.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
@media (min-width: 720px) { .tile-grid { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.tile .tile-label { font-size: 13px; color: var(--ink-2); }
.tile .tile-value { font-size: 26px; font-weight: 600; margin-top: 2px; color: var(--ink); }
.tile .tile-note { font-size: 12px; color: var(--muted); margin-top: 2px; }

.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.f-chip {
  flex: none; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: #fff; color: var(--ink-2); border: 1px solid var(--line); text-decoration: none;
}
.f-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.search-row input {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 15px; min-width: 0;
}
.search-row .btn { flex: none; }

.a-line { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 14px; }
.a-line .k { color: var(--muted); flex: none; }
.a-line .v { text-align: right; word-break: break-all; }
.a-item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.a-item:last-child { border-bottom: none; }

.prod-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.prod-row:last-child { border-bottom: none; }
.prod-thumb {
  width: 56px; height: 56px; border-radius: 10px; flex: none; overflow: hidden;
  background: linear-gradient(160deg, #fdf3e3, #f6e3bf);
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.prod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prod-row .info { flex: 1; min-width: 0; }
.on-sale { background: var(--green-soft); color: var(--green); }
.off-sale { background: var(--gray-soft); color: var(--gray); }

.img-up { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.img-up .preview {
  width: 110px; height: 110px; border-radius: 12px; overflow: hidden; flex: none;
  background: linear-gradient(160deg, #fdf3e3, #f6e3bf);
  display: flex; align-items: center; justify-content: center; font-size: 44px;
}
.img-up .preview img { width: 100%; height: 100%; object-fit: cover; }

.section-title { font-size: 14px; font-weight: 700; color: var(--ink-2); margin: 16px 0 8px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }
.empty .e-ico { font-size: 40px; display: block; margin-bottom: 8px; }

.copy-link { border: none; background: none; color: var(--blue); font-size: 13px; cursor: pointer; padding: 4px 6px; }

/* 收款码（方案A：顾客扫码付款） */
.pay-qr { text-align: center; }
.pay-qr img {
  display: block; margin: 0 auto; width: 210px; max-width: 76%;
  aspect-ratio: 1; object-fit: contain; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
}

/* ---------- 统计页 ---------- */
.d-row {
  display: grid; grid-template-columns: 52px 1fr 76px; align-items: center;
  gap: 8px; padding: 4px 0;
}
.d-date { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.d-row.today .d-date { color: var(--ink); font-weight: 600; }
.d-bar-wrap { direction: ltr; }
.d-bar {
  display: block; height: 8px; background: var(--red);
  border-radius: 0 4px 4px 0;   /* 数据端圆角、基线端方角 */
}
.d-val { font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
.share-bar {
  display: block; height: 8px; background: var(--red);
  border-radius: 0 4px 4px 0; margin-top: 6px;
}
.status-wrap { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.status-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.status-item b { font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------- 电脑端（Web 端）适配 ≥768px：手机优先，宽屏增强 ---------- */
@media (min-width: 768px) {
  body { padding-bottom: 24px; }
  .view { max-width: 1000px; padding: 20px 20px 32px; }
  body.admin .view { max-width: 1080px; }

  /* 手机底部标签栏 → 顶部导航条（毛玻璃吸顶） */
  .tabbar {
    position: sticky; top: 0; bottom: auto; max-width: none;
    justify-content: center; gap: 4px;
    border-top: none; border-bottom: 1px solid var(--line);
    padding: 10px 16px;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  }
  .tabbar a {
    flex: none; flex-direction: row; gap: 7px;
    padding: 8px 18px; font-size: 14px; border-radius: 999px;
  }
  .tabbar a .ico { font-size: 18px; line-height: 1; }
  .tabbar .badge { position: static; margin-left: 4px; }

  /* 固定底部操作条 → 跟随滚动的吸底卡片 */
  .fb-space { display: none; }
  .footer-bar {
    position: sticky; bottom: 12px; max-width: 640px; margin: 14px auto 0;
    border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 6px 20px rgba(60, 45, 20, .15);
    padding: 12px 16px;
  }

  /* 首页：更大横幅 + 三列商品 */
  .hero { padding: 34px 30px 30px; }
  .hero h1 { font-size: 30px; }
  .hero .hero-apple { font-size: 92px; right: 26px; top: 18px; }
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }

  /* 商品详情：左图右信息 */
  .detail-main { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 26px; align-items: start; }
  .detail-name { font-size: 22px; }
  .detail-desc { font-size: 15px; }

  /* 表单页（登录/地址编辑）收窄居中 */
  .form-card { max-width: 560px; margin-left: auto; margin-right: auto; }
  .form-wrap { max-width: 560px; margin-left: auto; margin-right: auto; }

  /* 吸顶导航下方的弹出提示 */
  .toast { top: 64px; }
}
@media (min-width: 1180px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }

/* 桌面鼠标悬停反馈 */
@media (hover: hover) and (min-width: 768px) {
  .tabbar a:hover { background: #f4eee3; }
  .btn:not([disabled]):hover { filter: brightness(1.05); }
  .btn.ghost:not([disabled]):hover { background: #faf7f0; }
  .p-card:hover { transform: translateY(-2px); }
  .order-card:hover { box-shadow: 0 4px 14px rgba(60, 45, 20, .12); }
  .menu-item:hover { background: #faf6ee; }
}
