/* H5 前台样式。移动端优先，不引任何 UI 框架，避免公众号里加载慢。 */

:root {
  --brand: #1a7f5a;
  --brand-light: #e8f5ef;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --line: #e9ebee;
  --bg: #f5f6f7;
  --card: #ffffff;
  --danger: #d8464b;
  --warn: #d98b1f;
  --radius: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.page { max-width: 750px; margin: 0 auto; padding-bottom: 64px; min-height: 100vh; }
.page.no-tabbar { padding-bottom: 16px; }

.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0 8px;
}
.topbar-side {
  width: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.topbar-left { justify-content: flex-start; }
.topbar-right { justify-content: flex-end; }
.topbar-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  font-size: 15px;
  color: var(--brand);
  font-weight: 500;
  white-space: nowrap;
}
.topbar-back::before {
  content: "‹";
  font-size: 22px;
  line-height: 1;
  margin-top: -1px;
}


.content { padding: 12px; }

/* ---------- 卡片与列表 ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 10px; }

.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.row-gap { gap: 10px; }

.cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.cell:last-child { border-bottom: none; }
.cell-label { color: var(--text-2); }
.cell-value { font-weight: 500; text-align: right; }

.muted { color: var(--text-3); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.price { color: var(--danger); font-weight: 600; }
.price-big { color: var(--danger); font-weight: 700; font-size: 22px; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }

/* ---------- 商品 ---------- */

.product-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.product {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
}
.product-cover { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.product-body { padding: 8px 10px 12px; }
.product-title {
  font-size: 14px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 44px;
}
.product-sub { font-size: 12px; color: var(--text-3); }
.original { color: var(--text-3); text-decoration: line-through; font-size: 12px; margin-left: 6px; font-weight: 400; }

.detail-cover { width: 100%; }
.detail-content {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
  word-break: break-word;
}
.detail-content p { margin: 0 0 10px; }
.detail-content h3 { margin: 14px 0 8px; font-size: 16px; font-weight: 600; }
.detail-content ul { margin: 0 0 10px; padding-left: 1.35em; }
.detail-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 10px 0;
  border-radius: 6px;
}

/* ---------- 轮播 ---------- */

.swiper {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 12px;
  background: #e8eaed;
  touch-action: pan-y;
  user-select: none;
}
.swiper-track {
  display: flex;
  width: 100%;
  will-change: transform;
}
.swiper-slide {
  flex: 0 0 100%;
  width: 100%;
  position: relative;
}
.swiper-slide img {
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.product-swiper {
  border-radius: 0;
  margin: -12px -12px 12px;
  width: calc(100% + 24px);
  max-width: none;
}
.product-swiper .swiper-slide img {
  aspect-ratio: 1 / 1;
}
.swiper-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 2;
  pointer-events: none;
}
.swiper-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .45);
  transition: width .25s, background .25s;
  pointer-events: auto;
}
.swiper-dots span.on {
  width: 16px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.swiper-count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}

.list-card {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

/* ---------- 按钮 ---------- */

.btn {
  display: block;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 24px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
}
.btn:disabled, .btn.disabled { background: #c8cdd2; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-plain { background: #fff; color: var(--text-2); border: 1px solid var(--line); }
.btn-sm { display: inline-block; width: auto; padding: 6px 16px; font-size: 13px; border-radius: 16px; }

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 750px;
  margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
  z-index: 30;
}

/* ---------- 表单 ---------- */

.field { margin-bottom: 12px; }
.field-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.input, .textarea, .select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
.textarea { min-height: 76px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--brand); }

/* ---------- 标签与状态 ---------- */

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  background: var(--brand-light);
  color: var(--brand);
}
.tag-gray { background: #f0f1f2; color: var(--text-2); }
.tag-warn { background: #fdf4e3; color: var(--warn); }
.tag-danger { background: #fdecec; color: var(--danger); }

.notice {
  background: #fdf4e3;
  color: #8a5a12;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

.toasts { padding: 8px 12px 0; }
.toast {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 8px;
  background: var(--brand-light);
  color: var(--brand);
}
.toast-error { background: #fdecec; color: var(--danger); }
.toast-warning { background: #fdf4e3; color: var(--warn); }

/* ---------- 数据块 ---------- */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stat-value { font-size: 20px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-3); }

.hero {
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.hero .stat-label { color: rgba(255, 255, 255, .75); }
.hero .stat-value { color: #fff; }

/* ---------- 预约日历 ---------- */

.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { font-size: 12px; color: var(--text-3); text-align: center; padding: 4px 0; }
.day {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 2px;
  text-align: center;
  background: #fff;
  cursor: pointer;
}
.day-num { font-size: 15px; font-weight: 600; }
.day-note { font-size: 10px; color: var(--text-3); }
.day.disabled { background: #f7f8f9; color: #c8cdd2; cursor: not-allowed; }
.day.disabled .day-note { color: #c8cdd2; }
.day.selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.day.selected .day-note { color: rgba(255, 255, 255, .85); }
.day-empty { border: none; background: none; }

/* 名额颜色：充足 / 一般 / 紧张 / 已满 / 我已约 */
.day.level-high {
  background: #e8f7ef;
  border-color: #8fd6b0;
  color: #0f6b45;
}
.day.level-high .day-note { color: #2a8f5f; }
.day.level-mid {
  background: #fff8e6;
  border-color: #f0c96a;
  color: #8a6200;
}
.day.level-mid .day-note { color: #a67c00; }
.day.level-low {
  background: #ffece8;
  border-color: #f0a090;
  color: #b33b22;
}
.day.level-low .day-note { color: #c44a30; }
.day.level-full {
  background: #eef0f2;
  border-color: #d5d9de;
  color: #9aa3ad;
}
.day.level-mine {
  background: #e8f0ff;
  border-color: #7aa2f0;
  color: #1d4fbf;
  box-shadow: inset 0 0 0 1px rgba(29, 79, 191, .15);
}
.day.level-mine .day-note { color: #3b6fd6; font-weight: 600; }
.day.level-past,
.day.level-closed,
.day.level-blocked,
.day.level-gap {
  background: #f7f8f9;
  border-color: #e6e8eb;
  color: #c8cdd2;
}
.day.level-past .day-note,
.day.level-closed .day-note,
.day.level-blocked .day-note,
.day.level-gap .day-note { color: #c8cdd2; }
.day.selected.level-high,
.day.selected.level-mid,
.day.selected.level-low,
.day.selected.level-mine {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: none;
}
.day.selected.level-high .day-note,
.day.selected.level-mid .day-note,
.day.selected.level-low .day-note,
.day.selected.level-mine .day-note { color: rgba(255, 255, 255, .85); }

.day-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--text-3);
}
.day-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.day-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid transparent;
}
.day-legend .lg-high { background: #e8f7ef; border-color: #8fd6b0; }
.day-legend .lg-mid { background: #fff8e6; border-color: #f0c96a; }
.day-legend .lg-low { background: #ffece8; border-color: #f0a090; }
.day-legend .lg-full { background: #eef0f2; border-color: #d5d9de; }
.day-legend .lg-mine { background: #e8f0ff; border-color: #7aa2f0; }

.month-label { font-size: 14px; font-weight: 600; margin: 14px 0 8px; }

/* 按月切换的标准月历（一周 7 列） */
.month-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 10px;
}
.month-nav-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 20px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}
.month-nav-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.month-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}
.cal-weekdays span { padding: 2px 0; }

.day-grid,
.cal-grid {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  gap: 4px;
}
.day-grid .day.month-hidden,
.cal-grid .day.month-hidden { display: none !important; }

.day-grid .day,
.cal-grid .day {
  min-width: 0;
  min-height: 52px;
  padding: 4px 2px 3px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.day-grid .day-num,
.cal-grid .day-num {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}
.day-grid .day-note,
.cal-grid .day-note {
  font-size: 9px;
  line-height: 1.2;
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.day-empty {
  min-height: 52px;
  border: none !important;
  background: transparent !important;
  pointer-events: none;
}

.slot-list { display: flex; flex-wrap: wrap; gap: 8px; }
.slot {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  min-width: 42%;
  flex: 1 1 42%;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.slot .slot-name { font-weight: 600; font-size: 14px; }
.slot .slot-remain { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.slot.selected {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 0 0 2px rgba(26, 127, 90, .2);
}
.slot.selected .slot-remain { color: var(--brand); }
.slot.disabled {
  background: #f7f8f9;
  color: #c8cdd2;
  cursor: not-allowed;
}
.day.selected {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

/* ---------- 底部导航 ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 750px;
  margin: 0 auto;
  height: calc(52px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  z-index: 25;
}
.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-2);
}
.tab.active { color: var(--brand); font-weight: 600; }

/* ---------- 空状态 ---------- */

.empty { text-align: center; color: var(--text-3); padding: 48px 16px; font-size: 14px; }

/* ---------- 流水表 ---------- */

.tx { padding: 12px 0; border-bottom: 1px solid var(--line); }
.tx:last-child { border-bottom: none; }
.tx-amount { font-weight: 600; }
.tx-amount.plus { color: var(--brand); }
.tx-amount.minus { color: var(--danger); }
