/* ============================================================
   亲情一站 · 首页视觉主题 v2
   生成日期：2026-11-07
   说明：加载于 style.css 之后，仅做视觉覆盖，不改动结构逻辑
         删除本文件或移除引用即可完全回滚
   ============================================================ */

/* ---------- 基础版面 ---------- */
body {
  background: #f6f7f9;
  background-image: linear-gradient(180deg, #fff3f1 0%, #f6f7f9 220px, #f6f7f9 100%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 108px;
}

/* ---------- 顶部区域 ---------- */
.header {
  background: linear-gradient(135deg, #e5342c 0%, #c8141a 100%);
  padding: calc(12px + env(safe-area-inset-top)) 16px 14px;
  border-radius: 0 0 22px 22px;
  box-shadow: 0 6px 20px rgba(190, 20, 25, 0.28);
}
.header::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 0 0 22px 22px;
  background: radial-gradient(circle at 85% -10%, rgba(255,255,255,0.22), transparent 60%);
  pointer-events: none;
}
.header-top { position: relative; z-index: 1; }

.header .brand {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 1px;
  text-shadow: 0 2px 6px rgba(120, 8, 10, 0.35);
}
.header .sub {
  font-size: 11px;
  opacity: 0.88;
  margin-top: 3px;
  letter-spacing: 0.3px;
}

/* ---------- 搜索框 ---------- */
.search-bar { margin-top: 12px; position: relative; z-index: 1; }
.search-bar input {
  height: 40px;
  padding: 0 40px 0 16px;
  font-size: 13px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 10px rgba(120, 8, 10, 0.18);
  transition: box-shadow 0.2s;
}
.search-bar input::placeholder { color: #b9b9b9; }
.search-bar input:focus { box-shadow: 0 3px 14px rgba(120, 8, 10, 0.28); }
.search-bar .si { right: 14px; font-size: 15px; }

/* ---------- 功能插件面板 ---------- */
.plugin-panel {
  display: block;
  overflow: visible;
  background: #fff;
  border-radius: 18px;
  margin: 12px 12px 4px;
  padding: 14px 12px 10px;
  box-shadow: 0 8px 24px rgba(24, 28, 40, 0.08);
  position: relative;
  z-index: 2;
}
.plugin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 10px;
}
.plugin-title {
  font-size: 13px;
  font-weight: 800;
  color: #26292f;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.plugin-title::before {
  content: '';
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: linear-gradient(180deg, #e5342c, #c8141a);
}
.plugin-sub { font-size: 10px; color: #a3aab5; }

/* 图标宫格：4 列 */
.plugin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 8px;
}
.nav-btn {
  flex-direction: column;
  gap: 7px;
  padding: 10px 2px 9px;
  background: #f8f9fb;
  border: 1px solid #eff1f4;
  border-radius: 14px;
  color: #2b2f36;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  box-shadow: 0 1px 2px rgba(24, 28, 40, 0.03);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.nav-btn:active {
  transform: scale(0.95);
  opacity: 1;
  background: #fff5f3;
  border-color: #ffd6cd;
}
.nav-icon {
  font-size: 17px;
  width: 34px;
  height: 34px;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 11px;
  box-shadow: 0 2px 6px rgba(24, 28, 40, 0.08);
}
.nav-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  min-width: 16px;
  background: #e5342c;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  padding: 0 4px;
  border-radius: 999px;
}

/* ---------- 数据看板 ---------- */
.stats-bar {
  margin: -14px 12px 0;
  background: #fff;
  border-radius: 18px;
  border-bottom: none;
  padding: 16px 14px 14px;
  box-shadow: 0 8px 24px rgba(24, 28, 40, 0.08);
  position: relative;
  z-index: 2;
}
.stats-row1 { align-items: center; }
.stat-item { border-right: 1px solid #f2f3f5; }
.stat-item .num {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #d81e06;
  font-variant-numeric: tabular-nums;
}
.stat-item .label {
  font-size: 11px;
  color: #98a1ae;
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.stats-row2 { margin-top: 14px; padding: 0; gap: 10px; }
.stat-mini {
  border-radius: 12px;
  padding: 10px 10px;
  text-align: left;
  border: 1px solid #f0f1f4;
}
.stat-mini.high {
  background: linear-gradient(135deg, #fff4f2, #fff9f7);
  border-color: #ffe2dc;
}
.stat-mini.low {
  background: linear-gradient(135deg, #f2f8ff, #f8fbff);
  border-color: #dfeeff;
}
.stat-mini .sm-label { font-size: 10px; letter-spacing: 0.5px; }
.stat-mini.high .sm-label { color: #d81e06; }
.stat-mini.low .sm-label { color: #2a6fd6; }
.stat-mini .sm-name { font-size: 13px; margin-top: 4px; color: #2b2f36; }
.stat-mini .sm-val { font-size: 12px; margin-top: 2px; color: #7a828f; }

/* ---------- 商品列表 ---------- */
/* 关键修复：core.js 给「库存」项写了 grid-column:1/-1，
   但原样式 .spec-info 是 flex，该指令完全无效，库存被挤成一列导致换行错乱。
   这里改成 3 列网格，让 grid-column 真正生效（库存独占一行）。 */
.spec-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 8px;
  align-items: start;
}
.si-item { min-width: 0; }
.si-item .si-value { font-size: 15px; line-height: 1.25; word-break: break-all; }

.product-list { padding: 14px 12px 24px; }
.product-card {
  border-radius: 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(24, 28, 40, 0.07);
  transition: box-shadow 0.2s, transform 0.15s;
}
.product-card:active { transform: scale(0.995); }
.product-card.expanded {
  background: #fffaf8;
  box-shadow: 0 6px 22px rgba(216, 30, 6, 0.1);
}
.product-main { padding: 14px 16px 14px 42px; }
.product-name {
  font-size: 16px;
  font-weight: 800;
  color: #26292f;
  letter-spacing: 0.2px;
}
.product-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}
.spec-tabs { margin-top: 10px; }
.spec-tab {
  padding: 5px 12px;
  border-radius: 999px;
  border-color: #eceef1;
  background: #f7f8fa;
  font-size: 12px;
  transition: all 0.15s;
}
.spec-tab.active {
  background: #fff1ee;
  border-color: #ffd6cd;
  color: #d81e06;
  box-shadow: 0 2px 8px rgba(216, 30, 6, 0.12);
}
.spec-info {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #f0f1f4;
  gap: 8px;
}
.si-item .si-label { font-size: 10px; color: #a3aab5; letter-spacing: 0.4px; }
.si-item .si-value {
  font-size: 15px;
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.si-item .si-value.retail { font-size: 17px; color: #d81e06; }
.si-item .si-value.margin { color: #17a34a; font-size: 15px; }
.si-item .si-value.cost { color: #f08c00; }

.product-remark {
  margin-top: 10px;
  background: #f7f8fa;
  color: #9aa1ad;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 11px;
}
.expand-arrow {
  background: #fbfbfc;
  color: #b7bdc7;
  font-size: 11px;
  padding: 8px;
  letter-spacing: 0.3px;
}

/* 佣金详情区域 */
.commission-detail {
  background: #fffaf9;
  border-top: 1px solid #ffeae5;
  padding: 14px 16px;
}
.cd-title { font-size: 13px; letter-spacing: 0.3px; }
.cd-comm {
  border-radius: 12px;
  border-color: #ffe4dd;
  padding: 10px 4px;
}
.cd-comm .amt { font-size: 16px; }
.cd-grid { gap: 8px; }

/* ---------- 空状态 ---------- */
.empty-state { padding: 80px 24px; }
.empty-state .ei { font-size: 56px; opacity: 0.85; }
.empty-state .et { font-size: 14px; color: #a8b0bc; }

/* ---------- 悬浮按钮 ---------- */
.add-fab {
  bottom: calc(18px + env(safe-area-inset-bottom));
  padding: 15px;
  border-radius: 999px;
  font-size: 16px;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #e5342c, #c8141a);
  box-shadow: 0 10px 28px rgba(200, 20, 26, 0.38);
}
.add-fab:active { transform: translateX(-50%) scale(0.97); }

/* ---------- 弹窗 ---------- */
.modal-mask { background: rgba(16, 18, 24, 0.52); 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, #e5342c, #c8141a); letter-spacing: 1px; }
.modal-btn-cancel { border-radius: 12px; }

/* ---------- 桌面端居中 ---------- */
@media (min-width: 720px) {
  .stats-bar { max-width: 680px; margin-left: auto; margin-right: auto; }
  .product-list { max-width: 680px; margin: 0 auto; }
  .add-fab { max-width: 420px; }
}

/* ---------- 滑动收起顶部搜索区 ---------- */
body { overflow-anchor: none; }

.header .search-bar {
  max-height: 46px;
  overflow: hidden;
  transition: max-height 0.26s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease,
              margin-top 0.26s ease;
}
.header.slim .search-bar {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  pointer-events: none;
}
