:root {
  --primary: #0f766e;
  --primary-light: #14b8a6;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* 顶部 */
.topbar {
  padding: 16px 16px 8px;
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 20px; margin-bottom: 10px; }
.search-box input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: var(--bg);
}

/* tab */
.tabs {
  display: flex;
  background: var(--card);
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 76px;
  z-index: 9;
}
.tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: none;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  background: var(--danger);
  color: #fff;
  border-radius: 9px;
  font-size: 12px;
}
.hidden { display: none !important; }

/* 筛选 */
.filters {
  display: flex;
  gap: 8px;
  padding: 14px 16px 6px;
  overflow-x: auto;
}
.chip {
  white-space: nowrap;
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 内容区 */
.content { padding: 8px 16px 24px; }
.panel { display: none; }
.panel.active { display: block; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 8px;
}
@media (min-width: 560px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}

.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.thumb {
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #ccfbf1, #e0f2fe);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.card-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title {
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}
.price-row { display: flex; align-items: baseline; gap: 6px; }
.price { color: var(--danger); font-weight: 700; font-size: 16px; }
.list-price { color: var(--muted); font-size: 12px; text-decoration: line-through; }
.stock-tag { font-size: 11px; color: var(--muted); }
.stock-tag.in { color: var(--primary); }
.stock-tag.out { color: var(--danger); }

.card-actions { display: flex; gap: 6px; margin-top: auto; }
.btn {
  flex: 1;
  padding: 7px 0;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.btn.ghost { background: #fff; color: var(--primary); }
.btn:disabled { opacity: .5; cursor: default; }

/* 提醒 */
.alert-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.alert-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary-light);
  border-radius: 10px;
  padding: 12px 14px;
}
.alert-item .alert-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.alert-item .alert-msg { font-size: 13px; color: var(--muted); }
.alert-item .alert-time { font-size: 11px; color: #9ca3af; margin-top: 6px; }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 48px 0; }
