/* ============================================================
   亲情一站 · 首页 v3（全新版式）
   加载于 style.css 之后，只做视觉与版式覆盖，不改 core.js
   回滚：index.html 里改回 theme-v2.css / 删除本次引用
   ============================================================ */

/* ---------- 基础 ---------- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #22262e;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 100px;
  overflow-anchor: none;
}

/* ---------- 顶部 Hero ---------- */
.header.hero {
  position: relative;
  display: block;
  background: linear-gradient(150deg, #ee3b33 0%, #d3161c 55%, #b90f16 100%);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top)) 18px 26px;
  border-radius: 0 0 26px 26px;
  box-shadow: none;
  overflow: hidden;
  z-index: 1;
}
.header.hero::before {
  content: "";
  position: absolute;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  top: -140px; right: -70px;
  pointer-events: none;
}
.header.hero::after {
  content: "";
  position: absolute;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  top: 40px; right: -90px;
  pointer-events: none;
}

.hero-top { position: relative; display: flex; align-items: center; gap: 10px; z-index: 1; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: rgba(255, 255, 255, 0.95); color: #d3161c;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 900;
  box-shadow: 0 4px 12px rgba(120, 6, 10, 0.25);
}
.brand-block { flex: 1; min-width: 0; }
.brand-name { font-size: 16px; font-weight: 900; letter-spacing: 0.5px; }
.brand-sub { font-size: 11px; opacity: 0.75; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 5px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; flex: none;
  max-width: 128px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.hero-greet { position: relative; z-index: 1; margin-top: 18px; }
.greet-line { font-size: 20px; font-weight: 800; letter-spacing: 0.3px; }
.greet-date { font-size: 11px; opacity: 0.72; margin-top: 5px; letter-spacing: 0.4px; }

.search {
  position: relative; z-index: 1; margin-top: 16px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 14px; padding: 0 14px; height: 44px;
  box-shadow: 0 4px 14px rgba(120, 6, 10, 0.18);
}
.search input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 13px; color: #2a2f38; padding: 0; height: 100%;
}
.search input::placeholder { color: #b3b9c2; }
.search .divider { width: 1px; height: 16px; background: #eceef1; }
.search .scan { font-size: 16px; color: #8d959f; }

/* ---------- KPI 卡 ---------- */
.kpi-card {
  position: relative; z-index: 2;
  margin: -18px 14px 0;
  background: #fff; border-radius: 18px;
  box-shadow: 0 10px 28px rgba(24, 28, 40, 0.10);
  padding: 16px 6px 14px;
}
.kpi-row { display: flex; align-items: center; }
.kpi { flex: 1; text-align: center; position: relative; }
.kpi + .kpi::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 1px; height: 26px; background: #f1f2f5;
}
.kpi-num {
  font-size: 26px; font-weight: 900; color: #d3161c; letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums; line-height: 1.05;
}
.kpi-label { font-size: 11px; color: #98a1ae; margin-top: 5px; letter-spacing: 0.4px; }

.kpi-tags { display: flex; gap: 8px; padding: 14px 10px 0; }
.ktag {
  flex: 1; border-radius: 12px; padding: 9px 10px;
  background: linear-gradient(135deg, #fff5f3, #fffaf9);
  border: 1px solid #ffe6e0; min-width: 0;
}
.ktag.blue { background: linear-gradient(135deg, #f2f8ff, #f9fcff); border-color: #e1eeff; }
.ktag-label { font-size: 10px; letter-spacing: 0.4px; color: #d3161c; }
.ktag.blue .ktag-label { color: #2a6fd6; }
.ktag-val {
  font-size: 12px; font-weight: 700; color: #2b2f36; margin-top: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ktag-sub { font-size: 10px; color: #98a1ae; margin-top: 2px; }

/* ---------- 区块通用 ---------- */
.section { margin: 18px 14px 0; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px 10px;
}
.section-title {
  font-size: 14px; font-weight: 800; color: #22262e; letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 7px;
}
.section-title::before {
  content: ""; width: 3px; height: 14px; border-radius: 2px;
  background: linear-gradient(180deg, #ee3b33, #b90f16);
}
.section-more { font-size: 11px; color: #9aa1ad; display: flex; align-items: center; gap: 2px; cursor: pointer; }

/* ---------- 快捷入口（插件） ---------- */
.plugin-panel { background: transparent; }
.plugin-grid.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 8px;
  overflow: hidden;
  background: transparent;
  padding: 0;
  box-shadow: none;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn {
  background: #fff; border: 1px solid #f4f5f7; border-radius: 14px;
  padding: 12px 4px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  box-shadow: 0 3px 12px rgba(24, 28, 40, 0.05);
  position: relative; cursor: pointer;
  font-size: 11px; font-weight: 600; color: #33383f;
  white-space: nowrap; overflow: hidden;
  flex-shrink: 0;
  transition: transform 0.15s, background 0.15s;
}
.nav-btn:active { transform: scale(0.95); opacity: 1; background: #fff7f5; }
.nav-icon {
  width: 36px; height: 36px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; background: #f4f6f9;
  margin-bottom: 0; flex: none;
}
.nav-icon.i-red { background: #fff0ee; }
.nav-icon.i-blue { background: #eef4ff; }
.nav-icon.i-amber { background: #fff6e8; }
.nav-icon.i-green { background: #eefbf1; }
.nav-icon.i-slate { background: #f1f3f6; }
.nav-badge {
  position: absolute; top: 8px; right: 10px;
  background: #d3161c; color: #fff; font-size: 9px; font-weight: 700;
  line-height: 15px; min-width: 15px; text-align: center;
  border-radius: 999px; padding: 0 4px;
}

/* ---------- 筛选 ---------- */
.filters { display: flex; gap: 7px; overflow-x: auto; padding: 0 2px 12px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none; padding: 6px 13px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: #fff; color: #7c848f; border: 1px solid #edeef1;
  cursor: pointer; transition: all 0.15s;
}
.filter.on {
  background: #fff1ee; color: #d3161c; border-color: #ffd8d0;
  box-shadow: 0 2px 8px rgba(211, 22, 28, 0.10);
}

/* ---------- 商品卡 ---------- */
.product-list { padding: 0 14px 20px; }
.product-card {
  background: #fff; border-radius: 16px; margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(24, 28, 40, 0.065);
  overflow: hidden; position: relative;
  transition: box-shadow 0.2s;
}
.product-card.expanded { box-shadow: 0 8px 26px rgba(211, 22, 28, 0.12); }
.product-main { padding: 14px 14px 12px; display: block; }
.batch-check { position: absolute; left: 10px; top: 16px; width: 20px; height: 20px; z-index: 10; }

.product-top { display: flex; align-items: flex-start; gap: 10px; }
.product-name {
  font-size: 15px; font-weight: 800; color: #22262e; letter-spacing: 0.2px;
  line-height: 1.35;
}
.product-name > span:first-child { font-size: 15px !important; font-weight: 800 !important; color: #b9c0c9 !important; margin-right: 5px !important; }
.product-badge {
  font-size: 9.5px !important; font-weight: 600;
  padding: 2.5px 7px !important; border-radius: 999px;
  margin-left: 5px; vertical-align: 1px;
}
.badge-multi { background: #fff1ee !important; color: #d3161c !important; border: 1px solid #ffdcd5; }
.badge-custom { background: #eef4ff !important; color: #2a6fd6 !important; border: 1px solid #dbe8ff; }

.spec-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 11px; }
.spec-tab {
  font-size: 11px; padding: 4px 11px; border-radius: 999px;
  background: #f6f7f9; color: #7c848f; border: 1px solid #eef0f3;
  transition: all 0.15s;
}
.spec-tab.active {
  background: #fff1ee; color: #d3161c; border-color: #ffd8d0; font-weight: 600;
  box-shadow: 0 2px 6px rgba(211, 22, 28, 0.10);
}

/* 新版价格 / 元信息 / 库存（由 theme-v3.js 生成） */
.v3-price-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 11px; flex-wrap: wrap; }
.v3-price {
  font-size: 21px; font-weight: 900; color: #d3161c;
  line-height: 1; letter-spacing: -0.5px; font-variant-numeric: tabular-nums;
}
.v3-price .cur { font-size: 12px; font-weight: 700; margin-right: 1px; }
.v3-price .origin {
  font-size: 11px; color: #b9c0c9; font-weight: 500; text-decoration: line-through;
  margin-left: 7px;
}
.v3-profit {
  font-size: 10.5px; font-weight: 700; color: #128a3f;
  background: #eafaf0; border-radius: 6px; padding: 3px 7px; line-height: 1.3;
}
.v3-profit i { color: #7fb99a; font-weight: 600; font-style: normal; }

.v3-meta {
  display: flex; gap: 10px 14px; flex-wrap: wrap;
  margin-top: 10px; font-size: 11px; color: #9aa1ad;
}
.v3-meta b { color: #4a5058; font-weight: 700; margin-left: 3px; }
.v3-meta b.cost { color: #f08c00; }

.v3-stock { display: flex; align-items: center; gap: 8px; margin-top: 11px; padding-top: 11px; border-top: 1px dashed #f0f1f4; }
.v3-stock-text { font-size: 10.5px; color: #98a1ae; flex: none; }
.v3-stock-text b { color: #33383f; font-weight: 700; }
.v3-stock-bar { flex: 1; height: 6px; border-radius: 999px; background: #f1f2f5; overflow: hidden; }
.v3-stock-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ff8a80, #d3161c); }
.v3-stock-bar i.low { background: linear-gradient(90deg, #ffb199, #f4511e); }
.v3-stock-state { font-size: 10.5px; font-weight: 700; flex: none; }
.v3-stock-state.ok { color: #128a3f; }
.v3-stock-state.warn { color: #f08c00; }
.v3-stock-state.bad { color: #d3161c; }

/* 底部操作条 */
.expand-arrow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; background: #fcfcfd; border-top: 1px solid #f5f6f8;
  font-size: 11px; color: #9aa1ad; letter-spacing: 0.2px;
}

/* ---------- 佣金详情 ---------- */
.commission-detail {
  background: #fffaf9; border-top: 1px solid #ffeae5;
  padding: 14px 16px;
}
.cd-title { font-size: 13px; font-weight: 700; color: #d3161c; letter-spacing: 0.3px; margin-bottom: 8px; }
.cd-row { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; }
.cd-label { color: #8d959f; }
.cd-value { font-weight: 700; color: #33383f; }
.cd-value.red { color: #d3161c; }
.cd-value.green { color: #128a3f; }
.cd-comm { border-radius: 12px; border: 1px solid #ffe4dd; background: #fff; padding: 10px 4px; }
.cd-comm .amt { font-size: 16px; font-weight: 900; color: #d3161c; }
.cd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.cd-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
.cd-btn {
  flex: none; width: 100%; padding: 9px 2px; font-size: 11.5px; font-weight: 600;
  border-radius: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pickup-box { background: #fff; border: 1px solid #ffe4dd; border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.pb-title { font-size: 12px; font-weight: 700; color: #d3161c; margin-bottom: 6px; }
.pb-row { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0; }
.pbl { color: #8d959f; }
.pbv { font-weight: 700; color: #33383f; }

/* ---------- 空状态 ---------- */
.empty-state { padding: 60px 24px; text-align: center; }
.empty-state .ei { font-size: 52px; opacity: 0.85; }
.empty-state .et { font-size: 13px; color: #a8b0bc; margin-top: 8px; }

/* ---------- 悬浮按钮 ---------- */
.add-fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: calc(100% - 40px); max-width: 420px; height: 50px;
  border: 0; border-radius: 999px;
  background: linear-gradient(135deg, #ee3b33, #c8141a);
  color: #fff; font-size: 14px; font-weight: 700; letter-spacing: 1.5px;
  box-shadow: 0 10px 26px rgba(200, 20, 26, 0.35);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.add-fab:active { transform: translateX(-50%) scale(0.97); }

/* ---------- 弹窗 ---------- */
.modal-mask { background: rgba(16, 18, 24, 0.52); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-box {
  border-radius: 24px 24px 0 0;
  padding: 18px 18px calc(28px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(16, 18, 24, 0.18);
}
.modal-handle { background: #e6e8ec; width: 44px; }
.modal-title { font-size: 17px; font-weight: 800; letter-spacing: 0.4px; }
.form-group input, .form-group textarea {
  border-radius: 12px; border: 1.5px solid #eceef1; background: #fafbfc; padding: 11px 12px;
}
.form-group input:focus, .form-group textarea:focus { border-color: #e5342c; background: #fff; }
.modal-btn-ok { background: linear-gradient(135deg, #ee3b33, #c8141a) !important; letter-spacing: 1px; }
.modal-btn-cancel { border-radius: 12px; }

/* ---------- 桌面端 ---------- */
@media (min-width: 720px) {
  body { max-width: 680px; margin: 0 auto; }
  .header.hero { border-radius: 0 0 26px 26px; }
  .kpi-card { margin: -18px 14px 0; }
  .section { margin: 18px 14px 0; }
  .product-list { padding: 0 14px 20px; }
}
