/* =============================================================
   合伙人 · 数据大盘（全屏黑色大屏）
   -------------------------------------------------------------
   - .pd-wrap 直接铺满视口（position:fixed + inset:0），不套前台导航
     （app.js 里该路由 layout 为 'full'，天生就没有导航栏）
   - 严格一屏：页面级不出现滚动条，只有排行表 / 实时订单 / 地区幻灯片
     各自内部滚动或翻页（容器全部 flex + min-height:0）
   - 全部 .pd- 前缀，不与前台浅色主题互相污染
   ============================================================= */

.pd-wrap {
  --pd-bg: #04070f;
  --pd-panel: rgba(13, 21, 38, 0.92);
  --pd-panel-2: rgba(20, 32, 55, 0.85);
  --pd-line: rgba(76, 128, 200, 0.22);
  --pd-text: #dbe6f7;
  --pd-dim: #7d90b3;
  --pd-cyan: #22d3ee;
  --pd-blue: #4f8cff;
  --pd-green: #34d399;
  --pd-amber: #fbbf24;

  position: fixed;
  inset: 0;
  z-index: 900;              /* 低于 toast(1200)/AI 面板(1080)，不遮挡系统提示 */
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;            /* 移动端地址栏兼容 */
  padding: 12px 16px 10px;
  box-sizing: border-box;
  color: var(--pd-text);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(34, 211, 238, 0.12), transparent 62%),
    radial-gradient(900px 500px at 100% 0%, rgba(79, 140, 255, 0.14), transparent 55%),
    var(--pd-bg);
  overflow: hidden;
}

/* 网格底纹 */
.pd-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(90, 140, 210, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 140, 210, 0.055) 1px, transparent 1px);
  background-size: 46px 46px;
  pointer-events: none;
}

/* ---------- 顶栏 ---------- */
.pd-head {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pd-line);
}

.pd-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px 6px 10px;
  border-radius: 20px;
  border: 1px solid var(--pd-line);
  background: rgba(79, 140, 255, 0.12);
  color: var(--pd-text);
  font-size: 13px;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.pd-back:hover {
  border-color: var(--pd-cyan);
  color: #fff;
  box-shadow: 0 0 12px rgba(34, 211, 238, .25);
}
.pd-back-ico { font-size: 15px; line-height: 1; }

.pd-titles { min-width: 0; }
.pd-title {
  font-size: clamp(16px, 1.35vw, 22px);
  font-weight: 700;
  letter-spacing: 2px;
  white-space: nowrap;
  background: linear-gradient(90deg, #fff, var(--pd-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pd-sub {
  color: var(--pd-dim);
  font-size: 12px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-off-tip { color: var(--pd-amber); }

.pd-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pd-clock { color: var(--pd-cyan); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.pd-ranges { display: flex; gap: 6px; }
.pd-ranges button {
  background: rgba(79, 140, 255, 0.1);
  border: 1px solid var(--pd-line);
  color: var(--pd-dim);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.pd-ranges button:hover { color: var(--pd-text); border-color: rgba(34, 211, 238, .5); }
.pd-ranges button.on {
  background: linear-gradient(90deg, rgba(34, 211, 238, .25), rgba(79, 140, 255, .25));
  color: #fff;
  border-color: var(--pd-cyan);
  box-shadow: 0 0 12px rgba(34, 211, 238, .25);
}
.pd-ico {
  width: 34px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--pd-line);
  background: rgba(79, 140, 255, 0.1);
  color: var(--pd-dim);
  font-size: 15px;
  cursor: pointer;
  transition: all .18s;
}
.pd-ico:hover { color: #fff; border-color: var(--pd-cyan); }

/* ---------- 主体：严格一屏（grid: KPI 自适应 + 图表区吃满剩余高度）---------- */
.pd-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 12px 2px 0;
  overflow: hidden;          /* 页面级不出滚动条：只有面板内部滚 */
}

/* ---------- KPI ---------- */
.pd-kpis {
  display: grid;
  /* auto-fit：宽了自动 6 列，窄了自动掉列，不会挤爆也不会只剩一列 */
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 12px;
}
.pd-kpi {
  position: relative;
  background: var(--pd-panel);
  border: 1px solid var(--pd-line);
  border-radius: 12px;
  padding: 12px 14px;
  overflow: hidden;
  min-width: 0;
}
.pd-kpi::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--pd-blue);
}
.pd-kpi.k-cyan::after { background: var(--pd-cyan); }
.pd-kpi.k-green::after { background: var(--pd-green); }
.pd-kpi.k-amber::after { background: var(--pd-amber); }
.pd-kpi .k-lab { color: var(--pd-dim); font-size: 12px; letter-spacing: 1px; }
.pd-kpi .k-val {
  font-size: clamp(19px, 1.65vw, 27px);
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-kpi .k-foot {
  color: var(--pd-dim);
  font-size: 12px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 两栏（整列吃满，左右两列各自内部滚动）---------- */
.pd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.95fr) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}
/* 左右列：宽度比例由 .pd-grid 决定，这里只兜底防挤压
   （grid 子项默认 min-width:auto，会被表格/标签的 nowrap 内容撑破并挤出横向滚动条） */
.pd-col-l,
.pd-col-r { min-width: 0; }
.pd-col { display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; }

.pd-panel {
  background: var(--pd-panel);
  border: 1px solid var(--pd-line);
  border-radius: 12px;
  padding: 12px 14px 14px;
  min-width: 0;
  flex: 0 0 auto;            /* 默认按内容高度，不参与拉伸 */
}
/* 撑满剩余高度的面板（排行表 / 实时订单） */
.pd-panel.pd-grow {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pd-panel h6 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.pd-panel h6::before {
  content: '';
  width: 4px; height: 14px;
  border-radius: 2px;
  background: var(--pd-cyan);
  flex: 0 0 auto;
}
.pd-hint { color: var(--pd-dim); font-size: 11px; font-weight: 400; letter-spacing: 0; }
.pd-reset {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, .45);
  background: rgba(251, 191, 36, .12);
  color: var(--pd-amber);
  font-size: 11px;
  cursor: pointer;
}
.pd-reset:hover { background: rgba(251, 191, 36, .22); }

/* 面板内部滚动容器（flex 撑满，内部滚） */
.pd-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
.pd-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.pd-scroll::-webkit-scrollbar-thumb { background: rgba(79, 140, 255, .28); border-radius: 8px; }
.pd-scroll::-webkit-scrollbar-track { background: transparent; }

/* ---------- 走势图 ---------- */
.pd-panel-chart { flex: 0 0 auto; }
.pd-chart-box { position: relative; }
.pd-chart { width: 100%; height: clamp(130px, 19vh, 240px); display: block; }
.pd-chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--pd-dim); margin-top: 6px; }
.pd-chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

/* hover 十字线 / 数据点 / 提示框 */
.pd-cross {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(34, 211, 238, .55);
  pointer-events: none;
  transform: translateX(-.5px);
}
.pd-dot {
  position: absolute;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #22d3ee;
  border: 2px solid #04070f;
  box-shadow: 0 0 10px rgba(34, 211, 238, .9);
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.pd-tip {
  position: absolute;
  top: 6px;
  z-index: 5;
  pointer-events: none;
  min-width: 150px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(34, 211, 238, .35);
  background: rgba(6, 12, 24, .96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
  font-size: 12px;
  line-height: 1.6;
}
.pd-tip .t-date { color: var(--pd-cyan); font-weight: 600; margin-bottom: 4px; }
.pd-tip .t-row { color: var(--pd-dim); display: flex; align-items: center; gap: 6px; }
.pd-tip .t-row b { margin-left: auto; color: #fff; font-variant-numeric: tabular-nums; }
.pd-tip .t-row i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }

/* ---------- 条形（通用进度条） ---------- */
.pd-bar-track { height: 8px; background: rgba(120, 160, 220, .12); border-radius: 6px; overflow: hidden; }
.pd-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--pd-blue), var(--pd-cyan));
  transition: width .4s ease;
}

/* ---------- 地区幻灯片（左右翻页） ---------- */
.pd-slider { display: flex; align-items: stretch; gap: 6px; }
.pd-slides {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  /* auto-fit：一页两个地区；只有一个时自动占满整行 */
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.pd-slide {
  position: relative;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--pd-line);
  background: var(--pd-panel-2);
  cursor: pointer;
  transition: all .18s;
  min-width: 0;
}
.pd-slide:hover { border-color: rgba(34, 211, 238, .55); background: rgba(34, 211, 238, .08); }
.pd-slide.off { opacity: .42; filter: grayscale(.7); }
.pd-slide.off:hover { opacity: .75; border-color: rgba(251, 191, 36, .55); }
.pd-slide .rg-top { display: flex; align-items: center; gap: 6px; }
.pd-slide .rg-name { color: #fff; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-slide .rg-flag { margin-left: auto; font-size: 10px; color: var(--pd-amber); white-space: nowrap; }
.pd-slide .rg-mid { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 6px; }
.pd-slide .rg-orders { color: var(--pd-cyan); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pd-slide .rg-pct { color: var(--pd-dim); font-size: 11px; margin-left: auto; }
/* 外币金额（本地区币种，不跨币种相加）—— 与 RMB 折算值上下对照 */
.pd-slide .rg-foreign {
  color: var(--pd-dim); font-size: 11px; margin-top: 6px;
  font-variant-numeric: tabular-nums; letter-spacing: .2px;
}
.pd-slide .rg-foot { color: var(--pd-text); font-size: 12px; margin-top: 2px; font-variant-numeric: tabular-nums; }

.pd-arrow {
  flex: 0 0 auto;
  width: 22px;
  border-radius: 8px;
  border: 1px solid var(--pd-line);
  background: rgba(79, 140, 255, .1);
  color: var(--pd-dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: all .18s;
}
.pd-arrow:hover:not(:disabled) { color: #fff; border-color: var(--pd-cyan); }
.pd-arrow:disabled { opacity: .3; cursor: not-allowed; }

.pd-dots { display: flex; align-items: center; gap: 6px; margin-top: 10px; justify-content: center; }
.pd-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(120, 160, 220, .3);
  cursor: pointer;
  transition: all .18s;
}
.pd-dots i.on { background: var(--pd-cyan); width: 16px; border-radius: 4px; }
.pd-page-txt { color: var(--pd-dim); font-size: 11px; margin-left: 6px; }

/* ---------- 表格 ---------- */
.pd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pd-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0b1324;
  text-align: right;
  color: var(--pd-dim);
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--pd-line);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.pd-table th.ta-l, .pd-table td.ta-l { text-align: left; }
.pd-table th:first-child, .pd-table td:first-child { text-align: left; }
.pd-table th:hover { color: var(--pd-cyan); }
.pd-table td {
  text-align: right;
  padding: 8px 10px;
  border-bottom: 1px dashed rgba(76, 128, 200, .12);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pd-table tbody tr:hover { background: rgba(79, 140, 255, .07); }
.pd-rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 6px;
  font-size: 12px; margin-right: 8px;
  background: rgba(120, 160, 220, .16); color: var(--pd-dim);
}
.pd-rank.top { background: linear-gradient(135deg, var(--pd-amber), #f97316); color: #1a1206; font-weight: 700; }
.pd-tag {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 12px; margin-left: 4px;
  background: rgba(34, 211, 238, .14); color: var(--pd-cyan);
  white-space: nowrap;
}
.pd-name { color: #fff; }
.pd-dim { color: var(--pd-dim); }
.pd-money { color: #fff; font-weight: 600; }
/* 利润 = 该合作人带来的返佣收益（合伙人自己的钱，非平台利润） */
/* 实时模式标记：小绿点 + 文字 */
.pd-live { color: #34d399; font-weight: 600; }

/* 实时页空数据引导（内联 pill，不额外占布局高度） */
.pd-tipbar {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: 8px; padding: 1px 10px; border-radius: 999px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.32);
  color: #a5f3fc; font-size: 12px;
}
.pd-tipbar b {
  color: #22d3ee; cursor: pointer; font-weight: 600;
  border-bottom: 1px dashed rgba(34, 211, 238, 0.6);
}
.pd-tipbar b:hover { color: #67e8f9; }
.pd-live::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: #34d399; margin: 0 5px 1px 0; animation: pdPulse 1.6s ease-in-out infinite;
}
@keyframes pdPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.pd-profit { color: var(--pd-amber); font-weight: 600; }
/* 负利润 = 冻结不够扣（汇率上调/补差价），用红色警示，不做抹平 */
.pd-profit.pd-neg { color: #ff6b6b; }
.pd-foot .pd-profit { font-weight: 700; }
.pd-empty { text-align: center; color: var(--pd-dim); padding: 26px 0; font-size: 13px; }

/* ---------- 实时订单 ---------- */
.pd-recent { display: flex; flex-direction: column; gap: 8px; }
.pd-recent-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  background: var(--pd-panel-2);
  font-size: 13px;
  min-width: 0;
}
.pd-recent-row .r-main { min-width: 0; }
.pd-recent-row .r-user { font-weight: 600; color: #fff; }
.pd-recent-row .r-no {
  color: var(--pd-dim); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pd-recent-row .r-spend { margin-left: auto; color: var(--pd-cyan); font-weight: 600; white-space: nowrap; }
.pd-recent-row .r-foreign { font-size: 11px; font-weight: 400; text-align: right; margin-top: 2px; }

/* ---------- 底部口径说明 ---------- */
.pd-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--pd-line);
  color: var(--pd-dim);
  font-size: 12px;
}
.pd-foot-dot { opacity: .5; }
/* 口径告警：部分单没取到采购外币金额，已回退结算快照 */
.pd-foot .pd-warn { color: var(--pd-amber); }

.pd-loading { text-align: center; color: var(--pd-dim); padding: 40px 0; flex: 1 1 auto; }

/* =============================================================
   自适应：超宽屏 → 笔记本 → 平板 → 手机；矮屏单独压紧纵向留白
   ============================================================= */
/* 窄屏兜底：KPI 掉列后总高度必然超屏，这时才允许本体滚动（宽屏严格一屏） */
@media (max-width: 1080px) {
  .pd-body { overflow-y: auto; padding-right: 6px; }
  .pd-body::-webkit-scrollbar { width: 8px; }
  .pd-body::-webkit-scrollbar-thumb { background: rgba(79, 140, 255, .28); border-radius: 8px; }
  .pd-grid { min-height: 430px; }
  .pd-panel.pd-grow { min-height: 250px; }
}
@media (max-width: 980px) {
  .pd-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .pd-wrap { padding: 10px 10px 8px; }
  .pd-head { gap: 8px; }
  .pd-tools { width: 100%; justify-content: space-between; margin-left: 0; }
  .pd-back-txt { display: none; }
  .pd-back { padding: 6px 10px; }
  .pd-title { letter-spacing: 1px; }
  .pd-slides { grid-template-columns: minmax(0, 1fr); }
}
/* 矮屏（笔记本 768/800 高）：压紧纵向留白，保证核心数据一屏看全 */
@media (max-height: 820px) {
  .pd-wrap { padding: 10px 14px 8px; }
  .pd-kpi { padding: 10px 12px; }
  .pd-kpi .k-val { font-size: 20px; }
  .pd-chart { height: clamp(110px, 16vh, 175px); }
  .pd-foot { padding-top: 6px; margin-top: 6px; }
}
