:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --border: #dde3e8;
  --border-strong: #c7d0d8;
  --text: #1d2733;
  --muted: #64748b;
  --accent: #0e7c7b;
  --accent-strong: #0a6362;
  --accent-soft: #e2f3f2;
  --warn: #d97706;
  --warn-soft: #fdf0dc;
  --danger: #c2410c;
  --danger-soft: #fdeae2;
  --ok: #15803d;
  --ok-soft: #e3f3e8;
  --sidebar: #20242a;
  --sidebar-text: #cfd6de;
  --radius: 8px;
}

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

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0;
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand .logo {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: var(--radius);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.brand .name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.brand .sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.nav {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
}

.nav-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  padding: 10px 12px 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 2px 0;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 13.5px;
  text-decoration: none;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
}

.nav a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.nav .ico {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.6;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  flex: 0 0 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.crumbs {
  color: var(--muted);
  font-size: 12.5px;
}

.crumbs strong {
  color: var(--text);
  font-weight: 600;
}

.tabs-bar {
  height: 44px;
  flex: 0 0 44px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 0 24px;
  position: sticky;
  top: 56px;
  z-index: 4;
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  font-size: 13.5px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.tab:hover {
  color: var(--accent);
  text-decoration: none;
}

.tab.active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* Admin tab panes */
.tab-pane {
  display: none;
  padding-top: 20px;
}

.tab-pane.active {
  display: block;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.user-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

.content {
  width: 100%;
  max-width: 1280px;
  padding: 24px;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-head h1 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.page-head .desc {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.section {
  margin-bottom: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2 {
  font-size: 16px;
  font-weight: 600;
}

.section-title .sub {
  color: var(--muted);
  font-size: 12.5px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card .card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card .card-head h3 {
  font-size: 14.5px;
  font-weight: 600;
}

.card .card-body {
  padding: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.kpi.metric-card {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.kpi.metric-card:hover {
  border-color: var(--accent);
}

.kpi.metric-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.kpi .value.pending {
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
}

.kpi .label {
  color: var(--muted);
  font-size: 12.5px;
}

.kpi .value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
  line-height: 1.2;
}

.kpi .delta {
  font-size: 12px;
  margin-top: 6px;
  color: var(--muted);
}

.kpi .delta.up {
  color: var(--danger);
}

.kpi .delta.down {
  color: var(--ok);
}

.tree-box {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 8px;
  background: var(--panel);
  min-width: 260px;
  max-height: 260px;
  overflow: auto;
}

.tree-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}

.tree-node:hover {
  background: var(--accent-soft);
}

.tree-node.selected {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.tree-node.child {
  padding-left: 26px;
}

.tree-caret {
  width: 14px;
  text-align: center;
  color: var(--muted);
  display: inline-block;
  flex: none;
}

.tree-badge {
  background: #eef2ff;
  color: #4f46e5;
  font-size: 10px;
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 4px;
}

.tree-badge.tag-tmall {
  background: #ea580c;
  color: #fff;
}

.tree-badge.tag-pdd {
  background: #dc2626;
  color: #fff;
}

.tree-badge.tag-jd {
  background: #fff;
  color: #dc2626;
  border: 1px solid #dc2626;
}

.tree-badge.tag-douyin {
  background: #111827;
  color: #fff;
}

.filter-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  padding-top: 10px;
  /* 必须有 padding-bottom 或 border-bottom：否则内部 .filter-bar/.cockpit-controls 的
     margin-bottom 会穿透父级发生 margin collapse，sticky 背景盒贴在内容边缘，
     下方内容滚过来时被横向裁切（2026-10-26 商品动销页 KPI 标题被切成一半）。 */
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.product-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.product-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #f1f5f4;
  flex: none;
  cursor: zoom-in;
}

.product-thumb.placeholder {
  display: inline-block;
}

.product-info {
  min-width: 0;
}

.product-info strong {
  display: block;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spark {
  display: block;
  max-width: 110px;
  height: 30px;
}

#productTable th {
  position: relative;
  user-select: none;
}

#productTable th:first-child {
  min-width: 180px;
  max-width: 320px;
}

#productTable .col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  background: transparent;
  z-index: 2;
}

#productTable .col-resizer:hover {
  background: var(--accent);
  opacity: 0.35;
}

#productTable .sort-btns {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 4px;
  vertical-align: middle;
}

#productTable .sort-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  padding: 1px 2px;
  cursor: pointer;
}

#productTable .sort-btn:hover,
#productTable .sort-btn.active {
  color: var(--accent);
}

body.col-resizing {
  cursor: col-resize;
  user-select: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 14, 18, 0.86);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  background: #fff;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: #fff;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-end;
}

.cell-stack .mom,
.mom {
  font-size: 11px;
  color: var(--muted);
}

.mom.up {
  color: var(--danger);
}

.mom.down {
  color: var(--ok);
}

.product-id {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.copy-btn {
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--muted);
  border-radius: 4px;
  font-size: 11px;
  padding: 1px 6px;
  cursor: pointer;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.product-link {
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--accent-strong);
  border-radius: 4px;
  font-size: 11px;
  padding: 1px 6px;
  cursor: pointer;
  text-decoration: none;
}

.product-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 10px;
}

.platform-row {
  cursor: pointer;
}

.platform-row:hover td {
  background: var(--accent-soft);
}

.date-row td {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12.5px;
}

.expand {
  display: inline-block;
  width: 14px;
  text-align: center;
  color: var(--muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.grid-2 > *,
.grid-3 > * {
  min-width: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.tbl th,
table.tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

table.tbl th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  background: #fafbfc;
}

table.tbl tr:last-child td {
  border-bottom: 0;
}

table.tbl tbody tr:hover {
  background: #fafcfd;
}

.num {
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.accent {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.badge.neutral {
  background: #eef1f4;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

.btn.small {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-bar input,
.filter-bar select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--accent);
}

.alert {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 13px;
}

.alert.warn {
  background: var(--warn-soft);
  border-color: #f2d8ab;
  color: #7c4a03;
}

.alert.info {
  background: var(--accent-soft);
  border-color: #bfe0df;
  color: var(--accent-strong);
}

.info-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
}

.info-item {
  display: flex;
  gap: 8px;
  font-size: 13px;
}

.info-item .k {
  color: var(--muted);
  flex: 0 0 96px;
}

.info-item .v {
  font-weight: 500;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e8edf1;
  overflow: hidden;
}

.progress .bar {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.timeline {
  position: relative;
  padding-left: 18px;
}

.timeline li {
  list-style: none;
  position: relative;
  padding: 0 0 14px 6px;
  font-size: 13px;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: -11px;
  top: 16px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline .t {
  color: var(--muted);
  font-size: 12px;
}

.doc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-card h4 {
  font-size: 14px;
  font-weight: 600;
}

.doc-card p {
  color: var(--muted);
  font-size: 12.5px;
  flex: 1;
}

.doc-card .meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.footer-note {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.muted {
  color: var(--muted);
}

.mt {
  margin-top: 14px;
}

.mb {
  margin-bottom: 14px;
}

.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
}

.demo-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  vertical-align: 1px;
}

.demo-alert {
  margin-bottom: 16px;
}

.card-link {
  justify-content: flex-start;
  height: auto;
  min-height: 52px;
  padding: 10px 14px;
  white-space: normal;
  text-align: left;
}

.chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

.item-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
}

.thumb {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  object-fit: cover;
  background: #f7f9fb;
}

.thumb-empty {
  background: #eef1f4;
}

.thumb-link {
  display: block;
  line-height: 0;
  cursor: zoom-in;
}

.img-modal-body {
  height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-modal-body img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  object-fit: contain;
}

.spark {
  display: block;
}

/* 商品表迷你图：可点击放大成趋势弹窗，所以做成按钮而不是裸 SVG */
.spark-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding: 2px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  cursor: zoom-in;
  line-height: 0;
}

.spark-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.spark-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* 商品表店铺列：店名偏长，允许换行但不撑破表格 */
.shop-cell {
  display: inline-block;
  max-width: 168px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: normal;
  line-height: 1.35;
}

/* 趋势弹窗里的 Chart.js 需要一层带高度的定位父容器 */
.trend-canvas-wrap {
  position: relative;
  height: 360px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: 100%;
  max-width: 760px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  font-size: 14.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-body {
  padding: 16px;
  height: 360px;
}

/* 表单类弹窗（管理员页）：内容比 360px 高，必须自适应并允许滚动，
   否则底部「取消/保存」会被 .modal 的 overflow:hidden 裁掉（2026-10-22 实测）。 */
.modal-body.form-modal-body {
  height: auto;
  max-height: min(68vh, 640px);
  overflow-y: auto;
}

.report-embed {
  width: 100%;
  height: calc(100vh - 150px);
  min-height: 600px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
}

.cockpit-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.cockpit-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 120px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.cockpit-tab .muted {
  font-size: 11px;
  font-weight: 400;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cockpit-tab:hover {
  border-color: var(--accent);
}

.cockpit-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.chip:hover {
  border-color: var(--accent);
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── 商品动销（2026-10-26 重构）专用组件 ─────────────────────
   刻意不复用/不改 .chip.active：驾驶舱的平台与店铺 chip 依赖实心主色选中态，
   全局改它等于顺手改了用户没抱怨过的页面。这里用独立的 .chip.on。 */
.msel {
  position: relative;
  display: inline-block;
}

.msel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

.msel-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.msel-btn .caret {
  font-style: normal;
  color: var(--muted);
}

.msel-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 41;
  min-width: 260px;
  max-width: 420px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 32, 0.14);
}

.msel-panel[hidden] {
  display: none;
}

.msel-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.msel-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.chip.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 600;
}

/* 问题卡：诊断入口，点击即筛选主表 */
.issue-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.issue-card {
  text-align: left;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: border-color 0.12s ease, background 0.12s ease;
}

.issue-card:hover {
  border-color: var(--accent);
}

.issue-card.on {
  border-color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.issue-card .cap {
  font-size: 12.5px;
  color: var(--muted);
}

.issue-card .n {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.issue-card .hint {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.issue-card.sev-high { border-left-color: var(--danger); }
.issue-card.sev-high.on { background: var(--danger-soft); border-color: var(--danger); }
.issue-card.sev-data { border-left-color: var(--muted); }

/* 主表行下钻：展开的平台明细 */
tr.pm-detail > td {
  padding: 0 12px 12px;
  background: #fafcfd;
  border-bottom: 1px solid var(--border);
}

.pm-detail-wrap {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
  padding-top: 10px;
}

.pm-detail table.tbl {
  background: var(--panel);
}

.pm-weekbars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 46px;
}

.pm-weekbars i {
  display: block;
  width: 12px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  opacity: 0.75;
}

.pm-weekbars i.zero {
  background: var(--border-strong);
  opacity: 1;
}

/* 商品名列要能换行，否则 18 列 nowrap 的横向滚动又回来了 */
#pmTable td.pm-name {
  white-space: normal;
  min-width: 220px;
  max-width: 360px;
}

.cockpit-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.cockpit-controls.cockpit-row-date {
  margin-top: -6px;
  margin-bottom: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-strong);
}

/* 驾驶舱筛选：店铺固定在平台下方，切换平台时不再左右跳动/挤到同一行。
   店铺多的平台（天猫 20+ 家）靠 .chips 自身换行，行高变化不影响 sticky 定位。 */
.cockpit-controls.cockpit-row-ps {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.cockpit-controls .ctl {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cockpit-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.cockpit-controls select,
.cockpit-controls input[type="date"] {
  height: 32px;
  min-width: 130px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.cockpit-controls select:focus {
  border-color: var(--accent);
}

/* ===== 驾驶舱日期筛选（生意参谋同款：分段 + ‹› 步进 + 日历浮层） ===== */
.dt-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dt-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: var(--radius);
}

.dt-trigger:hover { background: var(--accent-soft); }
.dt-trigger b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dt-caret { font-style: normal; font-size: 10px; color: var(--muted); }

.dt-seg { display: inline-flex; }
.dt-seg .btn.small { border-radius: 0; margin-left: -1px; }
.dt-seg .btn.small:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.dt-seg .btn.small:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

.dt-arrow { width: 30px; padding: 0; margin-left: -1px; }
.dt-arrow:disabled { opacity: 0.4; cursor: not-allowed; }

.dt-cal {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  width: 268px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: rgba(187, 200, 227, 0.5) 0 4px 20px;
  padding: 10px 12px;
}

.dt-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.dt-cal-title { font-size: 13px; font-weight: 600; color: var(--text); }

.dt-nav {
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.dt-nav:hover:not(:disabled) { background: var(--accent-soft); }
.dt-nav:disabled { color: var(--border-strong); cursor: not-allowed; }

.dt-cal-table { border-collapse: collapse; width: 100%; }

.dt-cal-table th {
  height: 30px;
  font-size: 12px;
  font-weight: 400;
  color: #6b798e;
  background: #f4f6f9;
}

.dt-cal-table th:first-child { border-radius: 6px 0 0 6px; }
.dt-cal-table th:last-child { border-radius: 0 6px 6px 0; }

.dt-cal-table td {
  width: 34px;
  height: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.dt-cal-table td:hover:not(.disabled) { background: var(--accent-soft); }
.dt-cal-table td.other { color: #b7c3d0; }
.dt-cal-table td.disabled { color: #6b798e; background: #f4f6f9; cursor: not-allowed; }
.dt-cal-table td.in-range { background: var(--accent-soft); }
.dt-cal-table td.edge { background: var(--accent); color: #fff; font-weight: 600; }

.dt-cal::before {
  /* 悬停桥：盖住触发器与浮层之间 6px 缝隙，鼠标穿缝不误判为“移开” */
  content: "";
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

.dt-cal.wide { width: 516px; }
.dt-cal-cols { display: flex; gap: 12px; }
.dt-cal-col { flex: 1; min-width: 0; }
.dt-cal-foot { text-align: right; margin-top: 8px; }
.dt-cal-table td[data-month] { height: 44px; font-size: 13px; cursor: pointer; }
.dt-cal-table td[data-month].edge { border-radius: 8px; }

.dt-cal-tip { margin-top: 6px; font-size: 12px; color: var(--muted); }

.cockpit-window {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}

.cockpit-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.cockpit-toolbar .sub {
  margin-left: auto;
}

.chart-body {
  height: 320px;
  position: relative;
}

.chart-body {
  display: flex;
  gap: 12px;
}

.chart-main {
  flex: 1;
  min-width: 0;
  position: relative;
}

.chart-shop-labels {
  width: 150px;
  flex: 0 0 150px;
  overflow: auto;
  border-left: 1px solid var(--border);
  padding-left: 10px;
}

.chart-shop-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-shop-line.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chart-shop-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 8px;
}

.chart-shop-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 960px) {
  .layout {
    display: block;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 12px;
  }

  .nav-label,
  .sidebar-foot {
    display: none;
  }

  .nav a {
    white-space: nowrap;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2,
  .grid-3,
  .info-list {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 16px;
  }
}

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

  .topbar {
    padding: 0 14px;
  }

  .tabs-bar {
    padding: 0 14px;
  }

  .cockpit-window {
    margin-left: 0;
  }

  .report-embed {
    height: calc(100vh - 130px);
    min-height: 480px;
  }

  .user-chip {
    display: none;
  }
}

/* ── 商品动销（ERP 版，2026-10-29 翻新）────────────────────
   复用既有 chip / chip.on / msel / seg / kpi / tbl 组件，这里只补本页专属类。 */
tr.pm-row { cursor: pointer; }
.pm-denom { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.pm-modal-body { height: auto; max-height: 72vh; overflow-y: auto; }
