/* ============================================================
   一城宠业 · 宠物上门服务小程序 — 共享样式（Design Contract 冻结）
   布局机制：.phone 为纵向 flex（statusbar / screen / tabbar|actionbar）
   .screen 内部滚动，导航不使用 fixed 定位 → 永不漂移
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --primary: #FF7A45;
  --primary-deep: #E85D2C;
  --primary-soft: #FFEDE3;
  --accent: #2BB3A3;
  --accent-soft: #E3F5F2;
  --accent-deep: #1E8478;
  --bg: #FFF9F4;
  --surface: #FFFFFF;
  --border: #F0E4D8;
  --divider: #F6EEE5;
  --text: #2D2420;
  --text-sub: #8A7A6E;
  --text-faint: #B5A79A;
  --warning: #FFA940;
  --warning-soft: #FFF4E5;
  --warning-deep: #C77700;
  --danger: #E5484D;
  --danger-soft: #FDEBEC;
  --success: #34A97B;
  --gold: #FFB020;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(45, 36, 32, .05);
  --shadow-md: 0 6px 20px rgba(45, 36, 32, .08);
  --shadow-primary: 0 8px 20px rgba(255, 122, 69, .28);
  --font: "PingFang SC", "MiSans", "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans CJK SC", -apple-system, "Segoe UI", sans-serif;
}

/* ---------- Reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(160deg, #F6EADF 0%, #EFE0CE 100%);
  font-size: 14px;
  line-height: 1.5;
}
img { max-width: 100%; }
button { font-family: inherit; }
a { color: inherit; }
ul, ol { list-style: none; }

/* ---------- Phone 外壳 ---------- */
.phone {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 400px;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}
@media (min-width: 768px) {
  body { display: flex; align-items: center; justify-content: center; padding: 28px; height: 100vh; }
  .phone {
    height: min(860px, calc(100vh - 56px));
    max-width: 400px;
    border-radius: 44px;
    border: 10px solid #262019;
    box-shadow: 0 30px 80px rgba(45, 36, 32, .35);
  }
}

/* ---------- 状态栏（微信胶囊） ---------- */
.statusbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 14px 0 24px;
}
.sb-time { font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.wx-capsule {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid rgba(45, 36, 32, .12);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  background: rgba(255, 255, 255, .65);
  color: var(--text-sub);
}
.cap-divider { width: 1px; height: 14px; background: rgba(45, 36, 32, .15); }

/* ---------- 内容滚动区 ---------- */
.screen {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }

/* ---------- 底部 Tabbar（冻结导航） ---------- */
.tabbar {
  flex-shrink: 0;
  display: flex;
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--divider);
}
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 0;
  text-decoration: none;
  color: var(--text-faint);
  font-size: 11px;
  transition: color .2s;
}
.tab.active { color: var(--primary-deep); font-weight: 600; }
.tab .ico { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.tab.active .ico { transform: translateY(-1px) scale(1.1); }

/* ---------- 子页头部 ---------- */
.subheader {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  height: 48px;
  padding: 0 12px;
  background: var(--bg);
}
.back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text);
  border-radius: 50%; cursor: pointer;
}
.back:active { background: var(--divider); }
.sub-title { flex: 1; text-align: center; font-size: 17px; font-weight: 700; }
.sub-side { width: 36px; flex-shrink: 0; }

/* ---------- 底部操作栏 ---------- */
.actionbar {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--divider);
}
.action-info { flex: 1; min-width: 0; }

/* ---------- 图标基类 ---------- */
svg.ico { display: block; flex-shrink: 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer;
  font-family: inherit; font-weight: 600;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s;
  user-select: none;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 10px 22px;
  font-size: 15px;
  box-shadow: var(--shadow-primary);
}
.btn-ghost {
  background: var(--primary-soft);
  color: var(--primary-deep);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-size: 14px;
}
.btn-plain {
  background: var(--surface);
  color: var(--text-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  font-size: 13px;
}
.btn-danger-ghost {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  font-size: 13px;
}
.btn-lg { padding: 14px 26px; font-size: 16px; }
.btn-block { width: 100%; }
.btn.loading { pointer-events: none; opacity: .85; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 卡片 / 区块 ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(240, 228, 216, .6);
}
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 800;
  margin: 24px 16px 12px;
}
.section-title::before {
  content: "";
  width: 4px; height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), var(--primary-deep));
}
.section-title .more {
  margin-left: auto;
  font-size: 12px; font-weight: 400; color: var(--text-sub);
  display: flex; align-items: center; gap: 2px;
  text-decoration: none;
}

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 500;
  background: var(--divider); color: var(--text-sub);
  white-space: nowrap;
}
.tag-primary { background: var(--primary-soft); color: var(--primary-deep); }
.tag-success { background: var(--accent-soft); color: var(--accent-deep); }
.tag-warn { background: var(--warning-soft); color: var(--warning-deep); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-gold { background: #FFF6E0; color: #B8860B; }

/* ---------- 价格 / 头像 ---------- */
.price { color: var(--primary-deep); font-weight: 800; }
.price .rmb { font-size: .72em; font-weight: 700; margin-right: 1px; }
.price .unit { font-size: .72em; color: var(--text-sub); font-weight: 400; margin-left: 2px; }
.avatar { border-radius: 50%; object-fit: cover; background: var(--divider); display: block; }
.avatar-init {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff; font-weight: 700; flex-shrink: 0;
}

/* ---------- 分段 tab ---------- */
.seg {
  display: flex; gap: 6px;
  padding: 4px;
  background: var(--divider);
  border-radius: var(--radius-pill);
}
.seg-item {
  flex: 1; text-align: center;
  padding: 7px 4px;
  border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 600;
  color: var(--text-sub);
  cursor: pointer; white-space: nowrap;
  transition: all .2s;
  border: none; background: transparent; font-family: inherit;
}
.seg-item.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-wrap { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 16px; }

/* ---------- 选择 chip ---------- */
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  text-align: center;
  font-size: 13px; font-family: inherit;
  color: var(--text-sub);
  cursor: pointer;
  transition: all .15s;
}
.chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }
.chip.disabled { opacity: .35; pointer-events: none; }
.chip .chip-main { font-size: 13px; font-weight: 600; }
.chip .chip-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.chip.active .chip-sub { color: var(--primary-deep); }

/* ---------- 列表 cell ---------- */
.cell {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  text-decoration: none; color: var(--text);
  border: none; width: 100%; cursor: pointer; font-family: inherit; text-align: left;
}
.cell + .cell { border-top: 1px solid var(--divider); }
.cell-ico {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-soft); color: var(--primary-deep);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cell-title { flex: 1; font-size: 15px; font-weight: 600; min-width: 0; }
.cell-sub { font-size: 12px; color: var(--text-sub); font-weight: 400; margin-top: 2px; }
.cell .chev { color: var(--text-faint); }

/* ---------- 空状态 / Toast ---------- */
.empty {
  padding: 48px 24px;
  text-align: center; color: var(--text-faint);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 13px;
}
.toast {
  position: fixed; left: 50%; bottom: 120px;
  transform: translateX(-50%) translateY(12px);
  background: rgba(45, 36, 32, .92); color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  display: flex; align-items: center; gap: 8px;
  opacity: 0; pointer-events: none;
  transition: all .25s ease;
  z-index: 99; max-width: 82%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .ico { color: #7BD8C9; }

/* ---------- Banner ---------- */
.banner {
  margin: 0 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  position: relative;
  display: block;
}
.banner img { width: 100%; display: block; aspect-ratio: 16 / 8; object-fit: cover; }

/* ---------- 搜索 / 定位头 ---------- */
.searchbar {
  margin: 0 16px 12px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 10px 14px;
  color: var(--text-faint); font-size: 13px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(240, 228, 216, .7);
}
.loc-row { display: flex; align-items: center; gap: 6px; padding: 2px 16px 10px; font-size: 15px; font-weight: 700; }
.loc-row .ico { color: var(--primary-deep); }
.loc-sub { font-size: 11px; color: var(--text-sub); font-weight: 400; margin-left: 2px; }

/* ---------- 首页服务金刚位 ---------- */
.svc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 16px; }
.svc-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px;
  text-decoration: none; color: var(--text);
}
.svc-fig { width: 64px; height: 64px; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-sm); }
.svc-fig img { width: 100%; height: 100%; object-fit: cover; display: block; }
.svc-name { font-size: 14px; font-weight: 700; }
.svc-price { font-size: 12px; color: var(--primary-deep); font-weight: 600; }

/* ---------- 横滑容器 ---------- */
.hscroll {
  display: flex; gap: 12px;
  overflow-x: auto;
  padding: 2px 16px 8px;
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }

/* ---------- 客服卡片 ---------- */
.kefu-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
}
.kefu-card .btn { flex-shrink: 0; }

/* ---------- 订单卡 ---------- */
.order-card { margin: 0 16px 12px; padding: 14px 16px; display: block; text-decoration: none; color: var(--text); }
.order-head { display: flex; align-items: center; gap: 8px; }
.order-no { font-size: 12px; color: var(--text-faint); margin-left: auto; }
.order-body { display: flex; gap: 12px; margin-top: 12px; }
.order-fig { width: 64px; height: 64px; border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; }
.order-fig img { width: 100%; height: 100%; object-fit: cover; display: block; }
.order-info { flex: 1; min-width: 0; }
.order-title { font-size: 15px; font-weight: 700; }
.order-desc { font-size: 12px; color: var(--text-sub); margin-top: 3px; }
.order-time { font-size: 12px; color: var(--text-faint); margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.order-foot { display: flex; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--divider); }
.order-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 4px; }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--divider); margin-top: 4px; flex-shrink: 0; position: relative; z-index: 1; }
.tl-item::before {
  content: ""; position: absolute; left: 5px; top: 18px; bottom: -2px;
  width: 2px; background: var(--divider);
}
.tl-item:last-child::before { display: none; }
.tl-item.done .tl-dot { background: var(--accent); }
.tl-item.now .tl-dot { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.tl-title { font-size: 14px; font-weight: 600; }
.tl-item.now .tl-title { color: var(--primary-deep); }
.tl-time { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* ---------- 照片网格 / 时段 / 日期 ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-md); display: block; }
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.date-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 4px; scrollbar-width: none; }
.date-scroll::-webkit-scrollbar { display: none; }
.date-chip {
  width: 52px; flex-shrink: 0;
  padding: 8px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.date-chip .d-week { font-size: 11px; color: var(--text-faint); display: block; }
.date-chip .d-day { font-size: 16px; font-weight: 700; margin-top: 2px; display: block; }
.date-chip.active { border-color: var(--primary); background: var(--primary-soft); }
.date-chip.active .d-day { color: var(--primary-deep); }

/* ---------- 评价 ---------- */
.review-item { padding: 14px 16px; }
.review-head { display: flex; align-items: center; gap: 8px; }
.review-user { font-size: 13px; font-weight: 600; }
.review-stars { display: flex; gap: 1px; color: var(--gold); }
.review-text { font-size: 13px; line-height: 1.6; margin-top: 8px; }
.review-date { font-size: 11px; color: var(--text-faint); margin-top: 6px; }

/* ---------- KV 行 / 表单 ---------- */
.kv { display: flex; gap: 12px; padding: 10px 0; font-size: 14px; }
.kv + .kv { border-top: 1px dashed var(--divider); }
.kv-label { width: 72px; flex-shrink: 0; color: var(--text-sub); }
.kv-value { flex: 1; min-width: 0; }
.input, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255, 122, 69, .12); }
.textarea { min-height: 80px; resize: none; line-height: 1.6; }

/* ---------- 骨架屏 / 徽标 ---------- */
.skel {
  background: linear-gradient(90deg, var(--divider) 25%, #EDE2D4 50%, var(--divider) 75%);
  background-size: 200% 100%;
  animation: skel 1.2s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skel { to { background-position: -200% 0; } }
.badge {
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--danger); color: #fff;
  font-size: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
}

/* ---------- 工具类 ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-sub); }
.faint { color: var(--text-faint); }
.bold { font-weight: 700; }
.fs11 { font-size: 11px; } .fs12 { font-size: 12px; } .fs13 { font-size: 13px; }
.fs15 { font-size: 15px; } .fs17 { font-size: 17px; } .fs20 { font-size: 20px; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.px16 { padding-left: 16px; padding-right: 16px; }
.pb-safe { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.divider { height: 1px; background: var(--divider); border: none; }

/* ---------- 入场动效 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: revealUp .5s cubic-bezier(.22, .61, .36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}
@keyframes revealUp { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
}
