:root {
  --primary: #8f1d22;
  --text: #333;
  --text-2: #666;
  --text-3: #999;
  --line: #e5e5e5;
  --bg: #f7f7f7;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; background: #fff; }

/* ---------- 导航栏 ---------- */
.navbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  height: 46px; background: #fff;
  border-bottom: 1px solid #f0f0f0;
  padding: 0 12px;
}
.navbar-title { font-size: 17px; font-weight: 600; }
.back {
  position: absolute; left: 6px; top: 0; bottom: 0;
  width: 40px; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.navbar-right { position: absolute; right: 12px; }

/* ---------- 搜索 ---------- */
.search-wrap { padding: 10px 12px; background: #fff; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: #f2f2f2; border-radius: 20px;
  padding: 9px 14px;
}
.search-icon { flex: none; }
.search-box input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 15px; color: var(--text);
}
.search-box input::placeholder { color: #b2b2b2; }

/* ---------- 轮播 ---------- */
.banner {
  position: relative; overflow: hidden;
  background: linear-gradient(105deg, #f6efdd 0%, #f1e6cc 55%, #ece0c2 100%);
}
.banner-track { display: flex; transition: transform .45s ease; }
.banner-slide {
  flex: none; width: 100%; height: 132px;
  display: flex; align-items: center; gap: 18px;
  padding: 0 26px;
}
.stamp {
  flex: none; width: 84px; height: 84px; border-radius: 50%;
  border: 3px solid rgba(143, 29, 34, .85);
  outline: 1px solid rgba(143, 29, 34, .35); outline-offset: 3px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--primary); font-weight: 700; font-size: 22px; line-height: 1.25;
  background: rgba(255, 255, 255, .25);
  box-shadow: 0 2px 8px rgba(143, 29, 34, .12);
}
.slide-text { display: flex; flex-direction: column; gap: 6px; }
.slide-main { font-size: 24px; font-weight: 800; color: var(--primary); letter-spacing: 1px; }
.slide-badge {
  align-self: flex-start;
  background: var(--primary); color: #fff;
  font-size: 14px; font-weight: 700; letter-spacing: 2px;
  padding: 2px 12px; border-radius: 999px;
}
.slide-sub { font-size: 14px; color: #6b5b4a; letter-spacing: 1px; }
.banner-dots {
  position: absolute; left: 0; right: 0; bottom: 7px;
  display: flex; justify-content: center; gap: 7px;
}
.banner-dots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(120, 100, 80, .35);
}
.banner-dots i.on { background: #6b5b4a; }

/* ---------- 区块 ---------- */
.sec { padding: 14px 12px 4px; }
.sec-title {
  font-size: 16px; font-weight: 700; color: var(--primary);
  margin-bottom: 4px;
}
.fav-empty { text-align: center; color: #9b9b9b; font-size: 16px; padding: 34px 0; }
.fav-list { display: flex; flex-direction: column; }
.fav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 2px; border-bottom: 1px solid #f2f2f2;
  cursor: pointer;
}
.fav-item .f-name { font-size: 15px; font-weight: 600; }
.fav-item .f-effect {
  flex: 1; min-width: 0; font-size: 13px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fav-item .f-del {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: #f0f0f0; color: #b0b0b0; font-size: 13px; line-height: 1;
  cursor: pointer;
}

/* ---------- 处方列表 ---------- */
.recipe-list { display: flex; flex-direction: column; }
.recipe-item {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 2px; border-bottom: 1px solid #f2f2f2;
  cursor: pointer;
}
.recipe-item:active { background: #fafafa; }
.recipe-item .r-main { flex: 1; min-width: 0; }
.recipe-item .r-name { font-size: 16px; font-weight: 600; }
.recipe-item .r-effect {
  margin-top: 3px; font-size: 13px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recipe-item .r-count { flex: none; font-size: 12px; color: #c0a468; }
.recipe-item .r-arrow { flex: none; color: #ccc; font-size: 16px; }
.list-more, .list-end {
  text-align: center; font-size: 13px; color: var(--text-3);
  padding: 14px 0 18px;
}
.list-more { cursor: pointer; color: var(--text-2); }
.list-end { display: none; }

/* ---------- 详情 ---------- */
#view-detail { min-height: 100vh; background: #fff; }
.detail-body { padding: 16px 16px 90px; }
.d-name { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.d-sec { margin-bottom: 12px; line-height: 1.7; font-size: 15px; }
.d-sec .d-label { font-weight: 700; }
.d-note {
  color: var(--primary); font-weight: 700; font-size: 15px;
  line-height: 1.75; margin: 14px 0 4px;
}
.d-label-block { font-weight: 700; font-size: 15px; margin: 14px 0 10px; }
table.med-table {
  width: 100%; border-collapse: collapse; font-size: 15px;
}
table.med-table th, table.med-table td {
  border: 1px solid #e8e8e8;
  padding: 10px 8px;
}
table.med-table th { color: var(--text-2); font-weight: 500; background: #fff; }
table.med-table td { text-align: center; }
table.med-table td.m-name { text-align: center; }
table.med-table tr:nth-child(even) td { background: #fafafa; }

.detail-actions {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px;
  display: flex; gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line);
}
.detail-actions button {
  flex: 1; height: 42px; border-radius: 21px; border: 0;
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-fav { background: #fff; border: 1px solid var(--primary) !important; color: var(--primary); }
.btn-fav.faved { background: var(--primary); color: #fff; }
.btn-fav .heart { margin-right: 4px; }
.btn-share { background: var(--primary); color: #fff; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 18%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(0,0,0,.78); color: #fff;
  font-size: 14px; padding: 10px 18px; border-radius: 8px;
  opacity: 0; pointer-events: none;
  transition: all .25s ease; z-index: 99; max-width: 76vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
