/* =========================================================
   小熊代购工作台 — 统一样式
   配色对齐现有「小熊代购商城」(#c45c48 暖陶土红)
   叠加温暖橙红强调色(#fa541c)，整体协调、接地气且现代
   ========================================================= */

:root {
  --primary: #c45c48;
  --primary-dark: #a34836;
  --primary-soft: #f6e7df;
  --accent: #fa541c;
  --accent-soft: #fff1e9;
  --secondary: #f8e8d5;
  --bg: #fffaf5;
  --bg-alt: #fdf3ea;
  --card: #ffffff;
  --text: #3d2b24;
  --muted: #8c7b72;
  --border: #ece0d4;
  --success: #4a8b4a;
  --success-soft: #e8f3e8;
  --warn: #d98a00;
  --shadow: 0 4px 20px rgba(61, 43, 36, 0.08);
  --shadow-hover: 0 10px 28px rgba(196, 92, 72, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --tabbar-h: 60px;
  --appbar-h: 60px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", sans-serif;
  background:
    radial-gradient(1200px 480px at 80% -10%, #fff3ea 0%, rgba(255,243,234,0) 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #e3d2c3; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #d4bfac; }

/* ---------- 顶部应用栏 ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--appbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 3px 14px rgba(163, 72, 54, 0.25);
}
.appbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.appbar .brand .logo {
  font-size: 24px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.18));
}
.appbar .brand .sub {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.85;
  background: rgba(255,255,255,0.16);
  padding: 2px 9px;
  border-radius: 12px;
  margin-left: 4px;
}
.appbar-right { display: flex; align-items: center; gap: 12px; }
.appbar .updated {
  font-size: 12.5px;
  opacity: 0.92;
  text-align: right;
  line-height: 1.25;
}
.appbar .updated b { font-weight: 700; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(196,92,72,0.28); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-hover); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(250,84,28,0.3); }
.btn-accent:hover { filter: brightness(1.05); box-shadow: 0 8px 20px rgba(250,84,28,0.36); }
.btn-ghost { background: rgba(255,255,255,0.16); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,0.28); }
.btn-light { background: var(--secondary); color: var(--primary-dark); }
.btn-light:hover { background: #f1ddc6; }
.btn-line { background: #fff; color: var(--primary); border: 1.5px solid var(--border); }
.btn-line:hover { border-color: var(--primary); background: var(--primary-soft); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- 桌面标签导航 ---------- */
.tabnav {
  position: sticky;
  top: var(--appbar-h);
  z-index: 70;
  display: flex;
  gap: 6px;
  padding: 8px 18px;
  background: rgba(255, 250, 245, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(61,43,36,0.04);
  overflow-x: auto;
}
.tabnav::-webkit-scrollbar { height: 0; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s ease;
  border: 1.5px solid transparent;
  white-space: nowrap;
  user-select: none;
}
.tab .ic { font-size: 17px; line-height: 1; }
.tab:hover { color: var(--primary); background: var(--primary-soft); }
.tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 4px 14px rgba(196,92,72,0.3);
}
.tab .badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 内容区 ---------- */
main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 18px calc(var(--tabbar-h) + 28px);
}
.view { display: none; animation: fadeIn 0.32s ease; }
.view.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 14px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.section-title .dot { width: 6px; height: 20px; border-radius: 4px; background: var(--primary); }
.section-title .hint { font-size: 12.5px; font-weight: 400; color: var(--muted); margin-left: auto; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card.hoverable:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h3 { margin: 0; font-size: 15px; color: var(--primary-dark); }

/* ---------- 看板 KPI ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 16px 18px;
  color: #fff;
  box-shadow: var(--shadow);
}
.kpi::after {
  content: "";
  position: absolute;
  right: -18px; top: -18px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
}
.kpi .label { font-size: 13px; opacity: 0.92; display: flex; align-items: center; gap: 6px; }
.kpi .num { font-size: 30px; font-weight: 800; letter-spacing: 0.5px; margin-top: 6px; line-height: 1.1; }
.kpi .unit { font-size: 15px; font-weight: 600; margin-right: 2px; opacity: 0.9; }
.kpi .sub { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.kpi-orders { background: linear-gradient(135deg, #f08a4b, #ef6c3b); }
.kpi-sales  { background: linear-gradient(135deg, #c45c48, #a34836); }
.kpi-pending{ background: linear-gradient(135deg, #e0a32e, #cf8a16); }
.kpi-profit { background: linear-gradient(135deg, #5aa05a, #3f8a4a); }

/* ---------- 图表 ---------- */
.chart-wrap { margin-top: 4px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- 看板下半区 ---------- */
.dash-lower {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-pill {
  flex: 1 1 30%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.stat-pill .t { font-size: 12.5px; color: var(--muted); }
.stat-pill .v { font-size: 20px; font-weight: 800; color: var(--text); }
.stat-pill .v small { font-size: 13px; font-weight: 600; color: var(--muted); }
.best-cat {
  margin-top: 14px;
  background: linear-gradient(135deg, var(--secondary), #f3d9c2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.best-cat .emoji { font-size: 30px; }
.best-cat .txt b { color: var(--primary-dark); font-size: 17px; }
.moment-tip {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  color: #b8431a;
}
.moment-tip b { font-size: 18px; color: var(--accent); }

/* ---------- iframe 模块 ---------- */
.iframe-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  height: calc(100vh - 200px);
  min-height: 600px;
  display: flex;
  flex-direction: column;
}
.iframe-card .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  font-size: 13px;
  color: var(--muted);
}
.iframe-card iframe { flex: 1; width: 100%; border: 0; background: #fff; }

/* ---------- 报表 ---------- */
.search-fab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
}
.report-day {
  margin-bottom: 16px;
}
.report-day .day-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.report-day .day-label .line { flex: 1; height: 1px; background: var(--border); }
.file-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: all 0.16s ease;
}
.file-item:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.file-item .ficon {
  width: 38px; height: 38px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; flex: none;
}
.file-item .ficon.txt { background: #eaf3ea; color: var(--success); }
.file-item .ficon.docx { background: #e9eefb; color: #3a5bb0; }
.file-item .fmeta { min-width: 0; }
.file-item .fname { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .fkind { font-size: 12px; color: var(--muted); }
.empty-note { color: var(--muted); font-size: 13.5px; padding: 8px 2px; }

/* ---------- 快递模块 ---------- */
.express-note {
  display: flex;
  gap: 14px;
  background: linear-gradient(135deg, #fff6ee, #fdeede);
  border: 1px solid #f0d9c4;
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.express-note .big { font-size: 34px; }
.express-note h3 { margin: 0 0 6px; color: var(--primary-dark); font-size: 16px; }
.express-note p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.7; }
.skeleton-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.skeleton-table th, .skeleton-table td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.skeleton-table th { background: var(--secondary); color: var(--primary-dark); font-weight: 600; }
.skeleton-row td { color: var(--muted); background: repeating-linear-gradient(90deg, #faf6f1, #faf6f1 14px, #f3ece4 14px, #f3ece4 28px); }

/* ---------- 朋友圈：文案生成器 ---------- */
.gen-grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--primary-dark); margin-bottom: 6px; }
select, input[type="text"], textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
select:focus, input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.model-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.model-chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.16s ease;
}
.model-chip:hover { border-color: var(--primary); color: var(--primary); }
.model-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.copy-result {
  position: relative;
  margin-top: 4px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 16px 14px;
  min-height: 120px;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  color: var(--text);
}
.copy-result .placeholder { color: var(--muted); font-size: 14px; }
.copy-result .meta { margin-top: 10px; font-size: 12px; color: var(--muted); }
.copy-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }

/* ---------- 朋友圈：周历 ---------- */
.week-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.week-stats { display: flex; gap: 10px; }
.week-stat {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
}
.week-stat b { color: var(--accent); }
.week-theme-hint { font-size: 12px; color: var(--muted); }
.calendar {
  display: grid;
  grid-template-columns: 64px repeat(7, 1fr);
  gap: 8px;
}
.cal-corner, .cal-day {
  text-align: center;
  font-weight: 700;
}
.cal-corner { }
.cal-day {
  background: linear-gradient(135deg, var(--secondary), #f3dcc6);
  border-radius: 10px;
  padding: 8px 4px;
  font-size: 13.5px;
  color: var(--primary-dark);
}
.cal-day.today { box-shadow: 0 0 0 2px var(--accent); }
.cal-day .theme { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.cal-slot-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg-alt);
  border-radius: 10px;
}
.cal-cell {
  min-height: 58px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 6px 7px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
  overflow: hidden;
}
.cal-cell:hover { border-color: var(--primary); background: var(--primary-soft); }
.cal-cell.filled { border-style: solid; border-color: var(--primary); background: var(--primary-soft); }
.cal-cell .cell-model { font-size: 10.5px; color: var(--accent); font-weight: 700; }
.cal-cell .cell-text { margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.cal-cell .cell-empty { color: var(--muted); text-align: center; margin-top: 14px; opacity: 0.6; }

/* ---------- 朋友圈：素材库 ---------- */
.mat-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.mat-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.mat-filter {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.mat-filter:hover { border-color: var(--primary); color: var(--primary); }
.mat-filter.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.mat-models { margin-left: auto; font-size: 12px; color: var(--muted); }
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.mat-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.mat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.mat-card .thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: var(--bg-alt);
}
.mat-card .cap { padding: 8px 10px; }
.mat-card .cap .nm { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-card .cap .tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--secondary);
  color: var(--primary-dark);
  font-weight: 600;
}

/* ---------- 朋友圈：今日待发 ---------- */
.today-list { display: flex; flex-direction: column; gap: 10px; }
.today-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
}
.today-item .time-badge {
  flex: none;
  width: 54px;
  text-align: center;
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 13px;
}
.today-item .time-badge small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.today-item .body { flex: 1; min-width: 0; }
.today-item .body .txt { font-size: 13.5px; white-space: pre-wrap; line-height: 1.6; }
.today-item .body .model-tag { font-size: 11px; color: var(--accent); font-weight: 700; margin-top: 4px; display: inline-block; }

/* ---------- 朋友圈：数据复盘 ---------- */
.review-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.review-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.review-table th, .review-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: center; }
.review-table th { background: var(--secondary); color: var(--primary-dark); font-weight: 600; }
.review-table input { width: 56px; padding: 5px 6px; text-align: center; font-size: 13px; }
.review-table .post-name { text-align: left; font-weight: 600; }
.best-summary {
  background: linear-gradient(135deg, var(--secondary), #f4ddc6);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.best-summary .big-num { font-size: 15px; color: var(--muted); }
.best-summary .best-name { font-size: 26px; font-weight: 800; color: var(--primary); margin: 6px 0; }
.best-summary .detail { font-size: 12.5px; color: var(--muted); }

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(61, 43, 36, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 18px;
  backdrop-filter: blur(2px);
}
.modal-mask.show { display: flex; animation: fadeIn 0.2s ease; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.28);
  animation: pop 0.22s ease;
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; color: var(--primary-dark); }
.modal-close { border: none; background: var(--bg-alt); width: 32px; height: 32px; border-radius: 50%; font-size: 18px; cursor: pointer; color: var(--muted); }
.modal-close:hover { background: #f0e2d4; color: var(--text); }
.modal-body { padding: 18px; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal textarea { min-height: 110px; resize: vertical; }

/* 排期弹窗：可选素材 */
.sched-mats { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; margin-top: 8px; max-height: 180px; overflow: auto; }
.sched-mat {
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1/1;
}
.sched-mat img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sched-mat.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* ---------- 灯箱 ---------- */
.lightbox-mask {
  position: fixed; inset: 0; background: rgba(20,12,8,0.86);
  display: none; align-items: center; justify-content: center; z-index: 300; padding: 24px;
}
.lightbox-mask.show { display: flex; animation: fadeIn 0.2s ease; }
.lightbox-mask img { max-width: 90vw; max-height: 84vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.lightbox-cap { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 24px);
  transform: translateX(-50%) translateY(20px);
  background: rgba(61,43,36,0.94);
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: all 0.28s ease;
  z-index: 400;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 移动端底部 Tab 栏 ---------- */
.mobile-tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 90;
  height: var(--tabbar-h);
  display: none;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(61,43,36,0.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-tabbar .mtab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  position: relative;
}
.mobile-tabbar .mtab .ic { font-size: 21px; line-height: 1; }
.mobile-tabbar .mtab.active { color: var(--primary); }
.mobile-tabbar .mtab.active .ic { transform: translateY(-1px); }
.mobile-tabbar .mtab .badge {
  position: absolute;
  top: 4px; right: 50%;
  margin-right: -22px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-lower { grid-template-columns: 1fr; }
  .gen-grid { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .appbar { padding: 0 14px; }
  .appbar .brand { font-size: 16px; }
  .appbar .brand .sub { display: none; }
  .appbar .updated { font-size: 11px; }
  .tabnav { display: none; }            /* 移动端用底部 tab 栏 */
  .mobile-tabbar { display: flex; }
  main { padding: 14px 12px calc(var(--tabbar-h) + 20px); }
  .kpi .num { font-size: 24px; }
  .iframe-card { height: calc(100vh - 160px); min-height: 480px; }
  .calendar { grid-template-columns: 40px repeat(7, 1fr); gap: 4px; }
  .cal-day { font-size: 11px; padding: 6px 2px; }
  .cal-day .theme { display: none; }
  .cal-slot-label { font-size: 10px; }
  .cal-cell { min-height: 46px; padding: 4px; }
  .cal-cell .cell-text { -webkit-line-clamp: 2; }
  .mat-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .file-list { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* ---------- 看板增强：热销 Top5 / 待发货客户 ---------- */
.top5-list { display: flex; flex-direction: column; gap: 9px; }
.top5-item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.top5-item .rank {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: var(--secondary); color: var(--primary-dark); font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.top5-item .rank.r1 { background: linear-gradient(135deg, #f08a4b, #ef6c3b); color: #fff; }
.top5-item .rank.r2 { background: linear-gradient(135deg, #e0a32e, #cf8a16); color: #fff; }
.top5-item .rank.r3 { background: linear-gradient(135deg, #c45c48, #a34836); color: #fff; }
.top5-item .nm { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top5-item .qt { color: var(--muted); font-size: 12.5px; }
.pend-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow: auto; }
.pend-item {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.pend-item .pn { font-weight: 700; color: var(--text); }
.pend-item .ad { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.pend-item .nt { color: var(--muted); font-size: 11.5px; margin-top: 2px; line-height: 1.4; }

/* ---------- 朋友圈：发圈打卡 ---------- */
.today-item .publish-btn { flex: none; align-self: center; }
.today-item.published { border-left-color: var(--success); background: var(--success-soft); }
.today-item.published .done-tag {
  display: inline-block; font-size: 11px; font-weight: 700; color: var(--success);
  background: #fff; border: 1px solid #bfdcbf; border-radius: 8px; padding: 2px 8px; margin-top: 4px;
}

/* ---------- 朋友圈：卖点库 ---------- */
.selling-hint {
  font-size: 12.5px; color: var(--muted); margin-bottom: 14px;
  background: var(--accent-soft); border: 1px dashed var(--accent);
  border-radius: 10px; padding: 10px 12px;
}
.selling-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.selling-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
.selling-card .snm { font-size: 13px; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; }
.selling-card .snm .scat { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.selling-card textarea { min-height: 52px; font-size: 13px; }
.selling-card.filled { border-color: #cfe6cf; background: #fbfdfb; }

/* ---------- 运费对账 ---------- */
.freight-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.freight-sum { font-size: 13.5px; color: var(--text); background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.freight-sum b { color: var(--primary-dark); }
.freight-actions { display: flex; gap: 8px; }
.freight-add { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr .8fr auto; gap: 8px; margin-bottom: 12px; }
.freight-add input { padding: 8px 10px; font-size: 13px; }
.freight-list { display: flex; flex-direction: column; gap: 8px; }
.fr-item { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font-size: 13px; flex-wrap: wrap; }
.fr-item.done { opacity: .68; }
.fr-item .nm { font-weight: 700; min-width: 80px; }
.fr-item .meta { color: var(--muted); font-size: 12px; flex: 1; min-width: 130px; }
.fr-item .diff { font-weight: 800; white-space: nowrap; }
.fr-item .diff.refund { color: #c0392b; }
.fr-item .diff.extra { color: #2e7d32; }
.fr-item .st { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: var(--secondary); color: var(--primary-dark); white-space: nowrap; }
.fr-item .st.done { background: var(--success-soft); color: var(--success); }
.fr-item .ops { display: flex; gap: 6px; }
@media (max-width: 768px) {
  .freight-add { grid-template-columns: 1fr 1fr; }
  .freight-add .btn { grid-column: 1 / -1; }
  .fr-item .nm { min-width: 70px; }
}

/* ---------- 看板日期切换 ---------- */
.kpi-date-switch { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.day-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--border);
  background: #fff; font-size: 14px; font-weight: 700; color: var(--muted);
  cursor: pointer; transition: all .18s ease; font-family: inherit;
}
.day-btn span { font-size: 11px; font-weight: 600; opacity: .8; }
.day-btn:hover { border-color: var(--primary); color: var(--primary); }
.day-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px rgba(196,92,72,.28);
}
.day-btn.active span { color: #ffe9e0; }

/* ---------- 看板 · 月度汇总 / 明细表 ---------- */
.month-block { margin-bottom: 16px; }
.month-block:last-of-type { margin-bottom: 10px; }
.month-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.month-head b { font-size: 16px; color: var(--text); }
.mom-tag { font-size: 12.5px; font-weight: 700; }
.stat-pill.month-total {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: transparent;
}
.stat-pill.month-total .t { color: #ffe9e0; }
.stat-pill.month-total .v { color: #fff; }
.stat-pill.month-total .v small { color: #ffd9c9; }
#detail-table td, #detail-table th { white-space: nowrap; }
#detail-table td b { font-weight: 700; }

/* ---------- 看板日期切换 ---------- */
.gen-head {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.gen-total { font-size: 14px; color: var(--muted); }
.gen-total b { color: var(--primary); font-size: 16px; }
.gen-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gen-item {
  position: relative; display: flex; gap: 10px;
  padding: 12px 10px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: 12px; background: #fffdf9;
  transition: box-shadow .18s ease;
}
.gen-item:hover { box-shadow: 0 3px 10px rgba(196, 92, 72, .08); }
.gen-item .gen-no {
  flex: 0 0 22px; height: 22px; line-height: 22px; text-align: center;
  background: var(--primary); color: #fff; border-radius: 50%;
  font-size: 12px; font-weight: 700; margin-top: 3px;
}
.gen-body { flex: 1; min-width: 0; }
.gen-text {
  white-space: pre-wrap; word-break: break-word;
  font-size: 14px; line-height: 1.75; color: var(--text); margin-bottom: 8px;
}
.gen-meta { margin-top: 10px; font-size: 12px; color: #b39a86; text-align: right; }
/* 覆盖 .copy-actions 全局绝对定位（让它在 gen-item 内自然排列） */
.gen-item .copy-actions {
  position: static; display: flex; gap: 8px;
  justify-content: flex-end; flex-wrap: wrap; margin-top: 6px;
}
.gen-item .copy-actions .btn { padding: 6px 14px; font-size: 13px; }
@media (max-width: 480px) {
  .gen-actions { width: 100%; }
  .gen-actions .btn { flex: 1; }
  .gen-item .copy-actions { justify-content: stretch; }
  .gen-item .copy-actions .btn { flex: 1; }
}

/* ---------- 渠道销售额分布 ---------- */
.chan-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.chan-title {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; font-size: 16px; font-weight: 700; color: var(--text);
}
.chan-title .dot { width: 6px; height: 18px; border-radius: 4px; background: var(--primary); }
.chan-title .hint { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: auto; }
.chan-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.chan-card {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: #fff;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.chan-card::after {
  content: ""; position: absolute; right: -16px; top: -16px;
  width: 74px; height: 74px; border-radius: 50%; background: rgba(255,255,255,0.14);
}
.chan-card .c-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.chan-card .c-sales { font-size: 27px; font-weight: 800; margin-top: 6px; line-height: 1.1; }
.chan-card .c-sales small { font-size: 14px; font-weight: 600; opacity: .9; margin-right: 2px; }
.chan-card .c-sub { font-size: 12px; opacity: .92; margin-top: 2px; }
.chan-card .c-sub small { font-size: 11px; opacity: .9; }
.chan-ledger { background: linear-gradient(135deg, #f08a4b, #ef6c3b); }
.chan-wx { background: linear-gradient(135deg, #5bbf8a, #3fa873); }
.chan-douyin { background: linear-gradient(135deg, #5b9bd5, #3a78c2); }
.chan-taobao { background: linear-gradient(135deg, #f7c873, #eaa940); }
.chan-total { background: linear-gradient(135deg, #c45c48, #a34836); }

/* ---------- 本周累计：利润说明 ---------- */
.wk-note {
  margin-top: 12px; font-size: 11.5px; color: var(--muted);
  background: var(--bg-alt); border: 1px dashed var(--border);
  border-radius: 8px; padding: 8px 12px; line-height: 1.6;
}

@media (max-width: 900px) {
  .chan-grid { grid-template-columns: 1fr; }
}

/* ---------- 看板改版①：KPI 对比期 / 自定义档 / 渠道占比条 ---------- */
/* 客单价卡（沿用原待发货卡暖金渐变） */
.kpi-aov { background: linear-gradient(135deg, #e0a32e, #cf8a16); }

/* KPI 对比行：涨=红 跌=绿（国内电商惯例），白底胶囊保证渐变卡上的可读性 */
.kpi .kpi-cmp { font-size: 12px; font-weight: 700; margin-top: 5px; }
.kpi-cmp span {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 2px rgba(61, 43, 36, 0.12);
}
.kpi-cmp .cmp-up   { color: #A32D2D; }
.kpi-cmp .cmp-down { color: #0F6E56; }
.kpi-cmp .cmp-flat { color: #8c7b72; }

/* 自定义时间段 */
#range-extra { margin: -6px 0 14px; }
.custom-range-panel {
  display: none; align-items: center; gap: 8px;
  flex-wrap: wrap; margin: 0 0 14px;
}
.custom-range-panel .date-input {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font-size: 13px; background: var(--card);
  color: var(--text); font-family: inherit;
}
.custom-range-panel .cr-sep { color: var(--muted); font-size: 13px; }

/* 渠道占比条（水平堆叠，宽度=销售额占比；hover 经 title 显示金额） */
.chan-bar {
  display: flex; height: 26px; border-radius: 9px; overflow: hidden;
  margin: 10px 0 8px; background: var(--bg-alt);
  border: 1px solid var(--border);
}
.chan-seg {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff; min-width: 3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  white-space: nowrap; overflow: hidden;
}
.chan-bar-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted); margin-bottom: 10px;
}
.chan-bar-legend i {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 5px; vertical-align: -1px;
}
.chan-bar-empty {
  width: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--muted);
}

/* 待发货客户卡片标题里的单数 */
.pend-count { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 6px; }

@media (max-width: 900px) {
  .chan-bar { height: 22px; }
  .chan-bar-legend { gap: 10px; font-size: 11px; }
  .kpi .kpi-cmp { font-size: 11px; }
}

/* =========================================================
   封面门禁（wbgate.js）—— 未登录时只显示封面
   ========================================================= */
body.wb-locked { overflow: hidden; }
body.wb-locked .appbar,
body.wb-locked .tabnav,
body.wb-locked main,
body.wb-locked .mobile-tabbar,
body.wb-locked #modal-mask,
body.wb-locked #lightbox-mask { display: none !important; }

.wb-gate {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
  background:
    radial-gradient(900px 520px at 22% 10%, #fff2e4 0%, rgba(255, 242, 228, 0) 62%),
    radial-gradient(760px 460px at 82% 90%, #fdece2 0%, rgba(253, 236, 226, 0) 60%),
    var(--bg);
  transition: opacity 0.38s ease, transform 0.38s ease;
}
.wb-gate-out { opacity: 0; transform: scale(0.985); pointer-events: none; }

.wb-gate-inner {
  width: 100%; max-width: 384px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 38px 32px 24px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(61, 43, 36, 0.1);
}
.wb-gate-badge {
  width: 68px; height: 68px; margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fdf0e6, #f8ddcb);
  border: 1px solid #f2d5c2;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; line-height: 1;
  box-shadow: 0 6px 18px rgba(196, 92, 72, 0.14);
}
.wb-gate-title {
  margin: 0; font-size: 26px; font-weight: 700;
  letter-spacing: 3px; color: var(--text);
}
.wb-gate-sub { margin-top: 7px; font-size: 12.5px; color: var(--muted); letter-spacing: 1px; }
.wb-gate-line {
  width: 44px; height: 3px; margin: 18px auto; border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.wb-gate-note { margin: 0 0 20px; font-size: 12.5px; color: var(--muted); line-height: 1.75; }

.wb-gate-field { position: relative; }
#wb-gate-pass {
  width: 100%; height: 50px; padding: 0 62px 0 16px;
  font-size: 15px; color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border); border-radius: 12px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
#wb-gate-pass:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(196, 92, 72, 0.12);
}
#wb-gate-pass::placeholder { color: #c3b3a8; letter-spacing: 0.5px; }
.wb-gate-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer;
  font-size: 12.5px; color: var(--primary); padding: 8px 10px; border-radius: 8px;
}
.wb-gate-eye:hover { background: var(--primary-soft); }

.wb-gate-remember {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 2px 16px; font-size: 12.5px; color: var(--muted);
  cursor: pointer; user-select: none;
}
.wb-gate-remember input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

.wb-gate-btn {
  width: 100%; height: 50px;
  border: 0; border-radius: 12px; cursor: pointer;
  font-size: 15.5px; font-weight: 600; letter-spacing: 1px; color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 8px 20px rgba(196, 92, 72, 0.26);
  transition: transform 0.12s, box-shadow 0.2s, filter 0.2s;
}
.wb-gate-btn:hover { filter: brightness(1.04); box-shadow: 0 10px 26px rgba(196, 92, 72, 0.32); }
.wb-gate-btn:active { transform: translateY(1px); }
.wb-gate-btn:disabled { opacity: 0.68; cursor: default; box-shadow: none; }

.wb-gate-err { min-height: 20px; margin-top: 12px; font-size: 12.5px; color: #c0392b; line-height: 1.6; }
.wb-gate-foot { margin-top: 12px; font-size: 11.5px; color: #b9a99e; }

@keyframes wb-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.wb-shake { animation: wb-shake 0.42s ease; }
@media (prefers-reduced-motion: reduce) { .wb-shake { animation: none; } }

@media (max-width: 480px) {
  .wb-gate-inner { padding: 30px 22px 20px; border-radius: 18px; }
  .wb-gate-title { font-size: 23px; letter-spacing: 2px; }
}

