/* ========================================
   仓储库存与物流分析 - 看板样式
   ======================================== */

:root {
  --primary: #f97316;
  --primary-light: #fb923c;
  --primary-lighter: #fdba74;
  --primary-pale: #fff7ed;
  --bg: #f3f4f6;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --green: #22c55e;
  --red: #ef4444;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

/* 头部 */
.dashboard-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

/* 左侧：统计周期 / 数据截止 */
.header-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.header-period-line {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.header-period-line i { color: var(--primary); font-size: 13px; }
.header-period-line b { color: #111827; font-weight: 700; }
.header-deadline {
  font-size: 12px;
  color: var(--text-secondary);
  padding-left: 19px;
  white-space: nowrap;
}
.header-deadline b { color: #374151; font-weight: 600; }

.header-title {
  font-size: 24px;
  font-weight: 800;
  color: #111827;
  letter-spacing: 3px;
  white-space: nowrap;
}

.header-filters {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
}

.filter-group label {
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-group select {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  cursor: pointer;
  min-width: 64px;
  max-width: 92px;
}

.filter-cal {
  color: var(--text-secondary);
  font-size: 12px;
}

.filter-date-group { gap: 4px; padding: 4px 8px; }
.filter-date-group input[type="date"] { font-size: 11px; }

.filter-group input[type="date"] {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.date-sep {
  color: var(--text-secondary);
  margin: 0 2px;
}

/* 主体 */
.dashboard-body {
  padding: 16px 24px 32px;
}

/* KPI 卡片 */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 14px 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primary-pale);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.kpi-body {
  flex: 1;
  min-width: 0;
}

.kpi-title {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  white-space: nowrap;
}

.kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.kpi-unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 2px;
}

.kpi-trend {
  margin-top: 5px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.trend-up-green { color: var(--green); }
.trend-up-red { color: var(--red); }
.trend-down-green { color: var(--green); }
.trend-down-red { color: var(--red); }

/* 内容网格 */
.content-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.panel {
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.panel-full-height {
  min-height: 460px;
}

.structure-panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.structure-panel-body .chart-box {
  flex: 1;
  min-height: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-title .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.panel-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

.panel-extra {
  font-size: 11px;
  color: var(--text-secondary);
}

.panel-body {
  flex: 1;
  min-height: 0;
}

/* 1) 库存全景 - 流程（图标之间水平虚线箭头，数值到占比框带垂直虚线箭头） */
.flow-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: 100%;
  gap: 8px 12px;
  align-items: stretch;
  height: 100%;
  padding: 12px 4px 8px;
}

.flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
  height: 100%;
  padding: 4px 0 8px;
  position: relative;
}


.flow-name-top {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
  white-space: nowrap;
}

.flow-icon-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 58px;
  width: 100%;
}

.flow-icon-plain {
  font-size: 52px;
  color: var(--primary);
  line-height: 1;
}

.flow-h-arrow {
  position: absolute;
  left: calc(50% + 30px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  width: 42px;
}

.flow-bottom-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  position: relative;
}

.flow-solid-arrow {
  flex: 1;
  display: flex;
  justify-content: center;
  width: 100%;
  position: relative;
  min-height: 16px;
}

.flow-solid-line {
  width: 1px;
  height: 100%;
  border-left: 1px dashed var(--primary-light);
}

.flow-solid-head {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--primary-light);
}

.flow-value-wrap {
  padding: 4px 0;
}

.flow-value {
  font-size: 26px;
  font-weight: 700;
  color: #111827;
  display: inline-block;
  background: #ffe3c9;
  border: none;
  border-radius: 3px;
  padding: 2px 7px;
  line-height: 1.15;
}

.flow-dashed-arrow {
  flex: 1;
  display: flex;
  justify-content: center;
  width: 100%;
  position: relative;
  min-height: 16px;
}

.flow-v-line {
  width: 1px;
  height: 100%;
  border-left: 1px dashed var(--primary-light);
}

.flow-v-head {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--primary-light);
}

.flow-ratio-box {
  border: 1px solid #fdba74;
  background: #fff7ed;
  border-radius: 6px;
  padding: 8px 12px;
  display: inline-block;
  min-width: 86px;
}

.flow-ratio-label {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.2;
}

.flow-ratio-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
}

.flow-line {
  flex: 1;
  height: 0;
  border-top: 1px dashed var(--primary-light);
}

.flow-arrow-head {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--primary-light);
  margin-left: -2px;
  flex-shrink: 0;
}

.flow-note {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 0;
  padding-left: 0;
  white-space: nowrap;
}

/* 库存全景：说明固定在模块底部 */
.overview-panel-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 库存全景：两端铺满，去掉左右空白 */
.panel-overview { padding-left: 4px; padding-right: 4px; }
.panel-overview .flow-grid { padding: 12px 0 8px; }
.panel-overview .flow-ratio-box {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: 8px 4px;
}

.overview-panel-body .flow-container {
  flex: 1;
  display: flex;
  align-items: center;
}

/* 图表容器 */
.chart-box {
  width: 100%;
  height: 100%;
  min-height: 260px;
}

.chart-tall {
  min-height: 320px;
}

/* 2) 品类结构分析 - 下方占比汇总（与上方 X 轴品类列数严格拉齐） */
.structure-summary {
  border-top: 1px dashed var(--border);
  padding: 8px 6px 0 6px;
}

.structure-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  font-size: 12px;
}

.structure-row:last-child {
  margin-bottom: 0;
}

.structure-head-row {
  margin-bottom: 8px;
}

.structure-label {
  width: 72px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.structure-cells {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.structure-head-cell {
  text-align: center;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-all;
}

.structure-cell {
  text-align: center;
  color: var(--text);
  font-weight: 700;
  font-size: 9px;
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th,
.data-table td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table th {
  background: #fafafa;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  position: sticky;
  top: 0;
}

.data-table tbody tr {
  transition: background 0.15s;
}


.data-table tbody tr:last-child td {
  border-bottom: none;
}

.rank-cell {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: #fff;
}

.rank-1 { background: #ef4444; }
.rank-2 { background: #f97316; }
.rank-3 { background: #f59e0b; }
.rank-other { background: #e5e7eb; color: #6b7280; }

.text-left { text-align: left; }
.text-right { text-align: right; }

/* 仓库排名 - 库存金额进度条（值在右侧） */
.amount-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar-cell {
  flex: 1;
  height: 10px;
  background: #f3f4f6;
  border-radius: 5px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 5px;
}

.bar-value {
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  min-width: 38px;
  text-align: right;
}

/* 3) 仓库排名 - 一分为二：上半前5名 / 下半后5名 */
.ranking-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-half {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ranking-half > .table-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 表格撑满各自一半空间，行高自动均分，消除空白 */
.ranking-table {
  width: 100%;
  height: 100%;
}

/* 上下两半之间的虚线分隔 */
.ranking-half.ranking-bottom {
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}

.ranking-half-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 4px;
  flex-shrink: 0;
}

/* 排名半区标题右侧：由深到浅的横向虚线（替代原文字说明） */
.rh-line {
  flex: 1;
  min-width: 0;
  height: 0;
  border-top-width: 2px;
  border-top-style: dashed;
  -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.12) 100%);
  mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.12) 100%);
}

.rh-line-top { border-top-color: #f97316; }

.rh-line-bottom { border-top-color: #9ca3af; }

.rh-tag {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  padding: 2px 8px;
  border-radius: 3px;
  line-height: 1.4;
}

.rh-tag-top { background: var(--primary); }
.rh-tag-bottom { background: #9ca3af; }

.ranking-table th,
.ranking-table td {
  padding: 4px 6px;
}

/* 仓库类型徽标：生产库 / 销区库 */
.wh-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.wh-type-prod { background: #eff6ff; color: #2563eb; }
.wh-type-sale { background: #fff7ed; color: #ea580c; }

/* 4) 库存库龄分析 - 上下布局：上 donut+图例（图表放大），下明细表（铺满底部） */
.age-panel-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.age-top {
  flex: 1.3;
  min-height: 0;
  display: flex;
  gap: 10px;
}

.age-chart {
  flex: 1;
  min-width: 0;
  height: 100%;
}

.age-legend {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  position: relative;
  padding-left: 12px;
}

/* 中间分隔虚线：只占中间一段高度，上下留白 */
.age-legend::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 62%;
  border-left: 1px dashed #f97316;
}

.age-legend-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.7fr;
  align-items: center;
  gap: 6px;
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background 0.15s;
}

.age-legend-row:last-child {
  border-bottom: none;
}


.age-legend-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  cursor: default;
}


.age-legend-name {
  text-align: left;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.age-legend-vol,
.age-legend-ratio {
  text-align: right;
}

.age-legend-ratio {
  color: var(--primary);
  font-weight: 700;
}

.age-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.age-table-wrap .data-table {
  flex: 1;
  height: 100%;
}

.age-table-wrap .data-table th,
.age-table-wrap .data-table td {
  padding: 8px 6px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

.age-ratio {
  color: var(--primary);
  font-weight: 700;
}

.legend-info {
  flex: 1;
}

.legend-name {
  color: var(--text-secondary);
}

.legend-value {
  font-weight: 700;
  color: #111827;
}

.legend-ratio {
  color: var(--primary);
  font-weight: 700;
  min-width: 42px;
  text-align: right;
}

/* 5) 物流执行分析 - 铺满布局 */
.logistics-panel-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.logistics-panel-body .chart-box {
  flex: 1;
  min-height: 0;
}

/* 5) 物流执行分析底部 YTD 均值（与原图一致） */
.logistics-ytd {
  display: flex;
  justify-content: space-around;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.ytd-row {
  display: flex;
  width: 100%;
  align-items: stretch;
  border-top: 1px solid var(--border);
}

.ytd-label {
  width: 80px;
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  border-right: 1px solid var(--border);
  background: #f9fafb;
}

.ytd-cell {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  border-right: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ytd-cell:last-child {
  border-right: none;
}

.ytd-name {
  font-size: 12px;
  color: #374151;
  font-weight: 600;
  margin-bottom: 4px;
}

.ytd-value {
  font-size: 20px;
  font-weight: 700;
  color: #ef4444;
  margin-bottom: 4px;
  line-height: 1.2;
}

.ytd-yoy {
  font-size: 11px;
  color: #16a34a;
}

.ytd-yoy i {
  margin-right: 2px;
  vertical-align: middle;
}

/* 预警 */
.warning-table tbody tr {
  transition: background 0.15s;
}


.warning-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 11px;
  margin-right: 6px;
  vertical-align: middle;
}

.warning-badge.high { background: #fee2e2; color: #dc2626; }
.warning-badge.medium { background: #fef3c7; color: #d97706; }

.warning-count {
  color: #dc2626;
  font-weight: 700;
  font-size: 13px;
}

.warning-amount {
  color: #111827;
  font-weight: 700;
  font-size: 12px;
}

.warning-suggestion {
  color: var(--primary);
  font-weight: 600;
  font-size: 11px;
}

/* 模态框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 12px;
  width: 900px;
  max-width: 95vw;
  max-height: 85vh;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: #f3f4f6;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--primary-pale);
  color: var(--primary);
}

.modal-body {
  padding: 20px;
  overflow: auto;
  flex: 1;
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.modal-table th,
.modal-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

/* 下钻弹窗：目标基准行 */
.modal-table tr.baseline-row td {
  background: #fff7ed;
  border-top: 2px solid var(--primary);
  border-bottom: none;
  color: var(--primary);
  font-weight: 700;
  position: sticky;
  bottom: 0;
}

.modal-table .baseline-tag {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: 1px;
}

/* 6) 在途监控 · 按运输方式汇总块（浅橙占比框风格） */
.tr-blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  height: 100%;
  align-content: stretch;
}

.tr-block {
  border: 1px solid #fdba74;
  background: #fff7ed;
  border-radius: 6px;
  padding: 5px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.tr-block-total {
  background: #ffedd5;
  border-width: 2px;
}

.tr-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 3px;
  border-bottom: 1px dashed #fdba74;
  margin-bottom: 4px;
}

.tr-block-name {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tr-block-name i {
  color: var(--primary);
  font-size: 16px;
}

.tr-block-trips {
  font-size: 10px;
  color: var(--text-secondary);
}

.tr-block-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}

.tr-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.tr-metric-label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.tr-metric-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  line-height: 1.3;
}

/* 模块6：数值带万吨单位 + 可点击下钻 */
.tr-metric-value small {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 2px;
}

.tr-metric-value.drillable {
  cursor: pointer;
  border-radius: 4px;
  padding: 0 3px;
  transition: background 0.15s;
}

.tr-metric-value.drillable:hover {
  background: rgba(234, 88, 12, 0.12);
  text-decoration: underline;
}

/* 模块6：已发货未签收量（整条）+ 账龄分解（30天以内 / 超过30天） */
.tr-unsigned {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  min-width: 0;
  padding-bottom: 4px;
  border-bottom: 1px dashed #fdba74;
  margin-bottom: 5px;
}

/* 上半条：右格数值右对齐，与下半行右格数值同列 */
.tr-unsigned .tr-age-cell:last-child {
  justify-content: flex-end;
  border-left: 1px solid transparent;
}

.tr-unsigned-label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.tr-unsigned-count {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  line-height: 1.2;
}

.tr-unsigned-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  line-height: 1.2;
}

.tr-unsigned-value small,
.tr-unsigned-count small,
.tr-age-num small {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 2px;
}

.tr-age {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  flex: 1;
  min-width: 0;
  border-radius: 4px;
  overflow: hidden;
}

.tr-age-cell {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  padding: 0 8px;
}

.tr-age-cell:first-child { padding-left: 0; }

.tr-age .tr-age-cell + .tr-age-cell {
  border-left: 1px dashed #fdba74;
}

.tr-age-over {
  background: rgba(220, 38, 38, 0.07);
}

.tr-age-label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.tr-age-num {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  line-height: 1.25;
}

.tr-age-over .tr-age-label,
.tr-age-over .tr-age-num {
  color: #dc2626;
}

.tr-age-num.drillable,
.tr-unsigned-value.drillable,
.tr-unsigned-count.drillable {
  cursor: pointer;
  border-radius: 4px;
  padding: 0 3px;
  transition: background 0.15s;
}

.tr-age-num.drillable:hover,
.tr-unsigned-value.drillable:hover,
.tr-unsigned-count.drillable:hover {
  background: rgba(234, 88, 12, 0.12);
  text-decoration: underline;
}


/* 7) 仓储物流预警 - 4个色块 */
.warn-blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  min-height: 0;
}

.warn-block {
  border-radius: 6px;
  padding: 5px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.wb-red { background: #fef2f2; border: 1px solid #fecaca; }
.wb-amber { background: #fffbeb; border: 1px solid #fde68a; }
.wb-orange { background: #fff7ed; border: 1px solid #fdba74; }
.wb-blue { background: #fef2f2; border: 1px solid #fecaca; }

.warn-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-bottom: 3px;
  border-bottom: 1px dashed rgba(0,0,0,0.14);
  margin-bottom: 3px;
}
.warn-block-name {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.warn-threshold {
  font-size: 10px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(0,0,0,0.08);
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
}

/* 双总指标：预警数量 | 预警金额（中间竖线分隔） */
.warn-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.warn-metric { padding: 0 6px; min-width: 0; }
.warn-metric + .warn-metric { border-left: 1px solid rgba(0,0,0,0.14); }
.warn-metric-label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.warn-metric-value {
  font-size: 16px;
  line-height: 1.15;
  font-weight: 800;
  color: #111827;
  line-height: 1.25;
  white-space: nowrap;
}
.warn-metric-value.red { color: #dc2626; }
.warn-metric-value small {
  font-size: 11px;
  font-weight: 600;
  margin-left: 2px;
}

/* 底部明细区（虚线隔开） */
.warn-detail {
  border-top: 1px dashed rgba(0,0,0,0.14);
  margin-top: 3px;
  padding-top: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.warn-detail-label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.warn-detail-value {
  font-size: 14px;
  font-weight: 800;
  color: #111827;
  white-space: nowrap;
}
.warn-detail-value small { font-size: 11px; font-weight: 600; }

/* 长库龄：品类 chips */
.warn-detail-chips { justify-content: flex-start; flex-wrap: wrap; gap: 4px; }
.warn-chip {
  font-size: 10px;
  color: #92400e;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 1px 6px;
  white-space: nowrap;
}
.warn-chip b { color: #dc2626; }

/* 已发未签收：按运输方式（单行内联，避免被裁切） */
.warn-detail-modes { justify-content: space-between; gap: 4px; padding-top: 4px; margin-top: 4px; }
.warn-mode {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
}
.warn-mode + .warn-mode { border-left: 1px dashed rgba(0,0,0,0.14); }
.warn-mode-head {
  font-size: 10px;
  color: #374151;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.warn-mode-head i { color: #9a3412; font-style: normal; font-size: 10px; }
.warn-mode b { color: #dc2626; font-size: 11px; }

.modal-table th {
  background: #fafafa;
  color: var(--text-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.modal-table tbody tr:hover {
  background: var(--primary-pale);
}

/* 空状态 */
.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px;
  font-size: 12px;
}

/* 可下钻元素：光标 + 悬停反馈（模块6在途监控除外） */
.drillable {
  cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s, transform 0.15s;
}

.kpi-card.drillable:hover {
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.18);
  transform: translateY(-2px);
}

.flow-node.drillable:hover {
  background: var(--primary-pale);
  border-radius: 8px;
}

.data-table tbody tr.drillable:hover {
  background: var(--primary-pale);
}

.age-legend-row.drillable:hover {
  background: var(--primary-pale);
}

/* 响应式 */
@media (max-width: 1400px) {
  .kpi-row {
    grid-template-columns: repeat(4, 1fr);
  }
  .content-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .content-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-header {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
  }
  .header-filters {
    flex-wrap: wrap;
    justify-content: center;
  }
  .flow-container {
    flex-wrap: wrap;
    justify-content: center;
  }
  .flow-arrow {
    display: none;
  }
}

@media (max-width: 640px) {
  .kpi-row {
    grid-template-columns: 1fr;
  }
  .header-filters {
    flex-wrap: wrap;
  }
}
