/* 食材比价看板 · 内部 H5 原型 */

* {
  box-sizing: border-box;
}

[hidden],
.is-hidden {
  display: none !important;
}

body {
  margin: 0;
  font-family: "PingFang SC", -apple-system, "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #1a1a1a;
  line-height: 1.5;
}

.dashboard {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 14px 32px;
}

/* 顶栏 + 固定说明 */
.dash-header {
  margin-bottom: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.topbar__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.topbar__tag {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #ff6b3d;
  background: #fff0e8;
  border-radius: 999px;
}

.dash-notice {
  margin: 0;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #666;
  background: #fff8f5;
  border: 1px solid #ffe4d6;
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 统计卡片 */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat {
  padding: 12px 10px;
  text-align: center;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stat__num {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
}

.stat__num--warn {
  color: #e53935;
}

.stat__num--good {
  color: #2e7d32;
}

.stat__label {
  font-size: 11px;
  color: #888;
}

.stat--clickable {
  width: 100%;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.stat--clickable:disabled {
  opacity: 0.45;
  cursor: default;
}

.stat--clickable:not(:disabled):active {
  transform: scale(0.98);
}

.stat--clickable.is-active {
  border-color: #ffcdd2;
  background: #fffbfb;
  box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.1);
}

#statTotalBtn.is-active {
  border-color: #dbeafe;
  background: #f3f8ff;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.12);
}

#statAlertBtn.is-active {
  border-color: #ffcdd2;
  background: #fffbfb;
  box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.15);
}

#statAboveBtn.is-active {
  border-color: #c8e6c9;
  background: #f1f8f4;
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.12);
}

/* 分类筛选 */
.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  color: #666;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 999px;
  cursor: pointer;
}

.filter-btn.is-active {
  color: #fff;
  background: #ff6b3d;
  border-color: #ff6b3d;
}

/* 工具栏 */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  color: #888;
}

.toolbar__sort {
  font-family: inherit;
  font-size: 12px;
  color: #666;
  background: transparent;
  border: none;
  cursor: pointer;
}

/* 品项卡片 */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item-card {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.item-card.is-alert {
  border: 1px solid #ffcdd2;
  background: #fffbfb;
}

.item-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.item-card__code {
  font-size: 11px;
  color: #999;
}

.item-card__name {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.item-card__badge {
  flex-shrink: 0;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
}

.badge--up {
  color: #c62828;
  background: #ffebee;
}

.badge--down {
  color: #2e7d32;
  background: #e8f5e9;
}

.badge--flat {
  color: #666;
  background: #f0f0f0;
}

.item-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.meta-tag {
  padding: 3px 8px;
  font-size: 11px;
  color: #666;
  background: #f5f5f5;
  border-radius: 4px;
}

/* 价格对比区 */
.price-compare {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.price-compare--2 { grid-template-columns: 1fr 1fr; }
.price-compare--3 { grid-template-columns: 1fr 1fr 1fr; }

.price-box {
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  border-radius: 10px;
  background: #fafafa;
  min-height: 76px;
}

.price-box--market {
  background: #fff8f4;
  border: 1px solid #ffe0cc;
}

.price-box__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
  min-height: 26px;
  margin-bottom: 6px;
}

.price-box__label {
  font-size: 11px;
  color: #888;
  line-height: 1.3;
  margin: 0;
}

.price-box__value-wrap {
  margin-top: auto;
}

.price-box__value {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
}

.price-box__unit {
  font-size: 12px;
  font-weight: 400;
  color: #888;
}

.price-box--market .price-box__value,
.price-box__value--pending {
  color: #ff6b3d;
}

.price-entry-link {
  flex-shrink: 0;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: #ff6b3d;
  background: #fff3ee;
  border-radius: 4px;
  border: 1px solid #ffd4c4;
  white-space: nowrap;
}

/* 市场来源 */
.market-source {
  margin: 0;
  padding: 8px 10px;
  font-size: 12px;
  color: #555;
  background: #f9f9f9;
  border-radius: 8px;
}

.market-source span {
  color: #888;
}

.market-source.is-warn {
  color: #c62828;
  background: #ffebee;
}

.market-source.is-good {
  color: #2e7d32;
  background: #e8f5e9;
}

.market-source__meta {
  display: block;
  color: #666;
  line-height: 1.5;
}

.market-source__verdict {
  display: block;
  margin-top: 4px;
  font-weight: 600;
  line-height: 1.45;
}

.market-source__verdict.is-warn {
  color: #c62828;
}

.market-source__verdict.is-good {
  color: #2e7d32;
}

.market-source__verdict.is-flat {
  color: #666;
}

.item-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn {
  flex: 1;
  padding: 9px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  text-align: center;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.btn--primary {
  color: #fff;
  background: #ff6b3d;
}

.btn--ghost {
  color: #666;
  background: #f0f0f0;
}

.empty {
  display: none;
  padding: 40px 20px;
  text-align: center;
  font-size: 14px;
  color: #999;
}

.empty.is-show {
  display: block;
}

.footer {
  margin-top: 20px;
  text-align: center;
  font-size: 11px;
  color: #aaa;
}

.footer a {
  color: #ff6b3d;
  text-decoration: none;
}

/* 一级：分类卡片 */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.cat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 18px 16px;
  font-family: inherit;
  text-align: left;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  cursor: pointer;
}

.cat-card--disabled,
.cat-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cat-card__name {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 6px;
}

.cat-card__count {
  font-size: 14px;
  font-weight: 600;
  color: #ff6b3d;
  margin-bottom: 4px;
}

.cat-card__desc {
  font-size: 11px;
  color: #999;
}

.btn-back {
  display: inline-block;
  margin-bottom: 14px;
  padding: 8px 0;
  font-size: 14px;
  font-family: inherit;
  color: #ff6b3d;
  background: none;
  border: none;
  cursor: pointer;
}

.home-brief {
  padding: 24px 16px;
  text-align: center;
}

.home-brief__text {
  margin: 0;
  font-size: 14px;
  color: #999;
}

/* ── 布局演示：搜索栏 ── */
#viewHome .filters {
  margin-bottom: 12px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.search-wrap--compact {
  margin-bottom: 12px;
}

.search-wrap--home {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  gap: 10px;
}

.search-wrap--home .search-wrap__input {
  flex: 1;
  min-height: 48px;
  padding: 12px 16px;
  font-size: 16px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.search-wrap--home .search-wrap__input:focus {
  border-color: #ffb899;
  box-shadow: 0 0 0 3px rgba(255, 107, 61, 0.12);
}

.search-wrap--home .search-wrap__go {
  min-height: 48px;
  padding: 0 18px;
  font-size: 15px;
  border-radius: 12px;
}

.search-wrap__icon {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
  opacity: 0.45;
}

.search-wrap__input {
  flex: 1;
  min-width: 0;
  padding: 0;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a1a;
  background: transparent;
  border: none;
  outline: none;
}

.search-wrap__input::placeholder {
  color: #aaa;
}

.search-wrap__clear {
  flex-shrink: 0;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  color: #ff6b3d;
  background: #fff0e8;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.search-wrap__go {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: #ff6b3d;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.search-box {
  position: relative;
  margin-bottom: 16px;
}

.search-box .search-wrap {
  margin-bottom: 0;
}

.search-suggest {
  margin-top: 6px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.search-suggest__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  text-align: left;
  background: #fff;
  border: none;
  border-bottom: 1px solid #f3f3f3;
  cursor: pointer;
}

.search-suggest__item:last-of-type {
  border-bottom: none;
}

.search-suggest__item:active {
  background: #fff8f5;
}

.search-suggest__name {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.search-suggest__meta {
  margin-top: 2px;
  font-size: 11px;
  color: #999;
}

.search-suggest__empty,
.search-suggest__more {
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  color: #999;
  text-align: center;
}

.section-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: #888;
}

.detail-title {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
}

.footer__hint {
  margin-top: 4px;
  font-size: 10px;
  color: #ccc;
}

/* ── 布局演示：品类宫格（图标 + 色块） ── */
.cat-tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}

.cat-tile {
  display: flex;
  flex-direction: column;
  padding: 0;
  font-family: inherit;
  text-align: left;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cat-tile:active {
  transform: scale(0.98);
}

.cat-tile__visual {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 72px;
  color: #fff;
}

.cat-tile__icon {
  display: flex;
  width: 40px;
  height: 40px;
}

.cat-tile__icon svg {
  width: 100%;
  height: 100%;
}

.cat-tile__visual--frozen {
  background: linear-gradient(135deg, #4fc3f7 0%, #0288d1 100%);
}

.cat-tile__visual--fresh {
  background: linear-gradient(135deg, #ff8a80 0%, #e53935 100%);
}

.cat-tile__visual--vegetable {
  background: linear-gradient(135deg, #81c784 0%, #388e3c 100%);
}

.cat-tile__visual--dry {
  background: linear-gradient(135deg, #ffb74d 0%, #8d6e63 100%);
}

.cat-tile__visual--grain {
  background: linear-gradient(135deg, #ffd54f 0%, #f9a825 100%);
}

.cat-tile__visual--supplies {
  background: linear-gradient(135deg, #90a4ae 0%, #546e7a 100%);
}

.cat-tile__body {
  padding: 12px 14px 14px;
}

.cat-tile__name {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.cat-tile__count {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #ff6b3d;
}

.search-results {
  margin-top: 4px;
}

.search-results .item-list {
  margin-top: 0;
}

/* ── 方案 C：紧凑单行 emoji + 短标签 ── */
.cat-quick-grid {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  margin-bottom: 14px;
}

.cat-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.cat-chip:active {
  opacity: 0.75;
}

.cat-chip__emoji {
  font-size: 22px;
  line-height: 1;
}

.cat-chip__name {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  transform: scale(0.92);
  transform-origin: center top;
}

/* ── 方案 B：左 40% SKU 信息 + 右 60% 轮播 ── */
.cat-hero-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.cat-hero {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  min-height: 148px;
  padding: 0;
  font-family: inherit;
  text-align: left;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.cat-hero:active {
  opacity: 0.94;
}

.cat-hero__info {
  flex: 0 0 40%;
  min-width: 0;
  padding: 8px;
  background: #fff;
  border-right: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.cat-hero__catname {
  font-size: 12px;
  font-weight: 700;
  color: #ff6b3d;
  margin-bottom: 4px;
  line-height: 1.2;
  flex-shrink: 0;
}

.cat-hero__sku-rotator {
  position: relative;
  flex: 1;
  min-height: 96px;
}

.cat-hero__sku-pane {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.cat-hero__sku-pane.is-active {
  opacity: 1;
  pointer-events: auto;
}

.cat-hero__code {
  font-size: 9px;
  color: #999;
  line-height: 1.2;
}

.cat-hero__pname {
  margin: 1px 0 3px;
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-hero__tags {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  margin-bottom: 4px;
  overflow: hidden;
}

.cat-hero__tag {
  padding: 1px 4px;
  font-size: 8px;
  color: #666;
  background: #f5f5f5;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.cat-hero__tag:first-child {
  display: none;
}

.cat-hero__pricebox {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 6px;
  background: #fafafa;
  border-radius: 6px;
  margin-top: auto;
}

.cat-hero__plabel {
  font-size: 8px;
  color: #888;
  flex-shrink: 0;
}

.cat-hero__pvalue {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.1;
}

.cat-hero__punit {
  font-size: 11px;
  font-weight: 400;
  color: #888;
}

.cat-hero__empty {
  margin: 0;
  font-size: 11px;
  color: #999;
}

.cat-hero__pic {
  flex: 0 0 60%;
  position: relative;
  min-height: 148px;
  overflow: hidden;
  background: #ddd;
}

.cat-hero__slides {
  position: absolute;
  inset: 0;
}

.cat-hero__frame {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s ease;
}

.cat-hero__frame.is-active {
  opacity: 1;
}

.cat-hero__slide {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


.cat-hero__ad {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
