:root {
  --navy: #1d1d1f;
  --navy-2: #2d2d2f;
  --blue: #0071e3;
  --teal: #30b0c7;
  --orange: #ff9f0a;
  --amber: #ffd60a;
  --red: #ff453a;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --panel: #ffffff;
  --canvas: #f5f5f7;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.055);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
}

button,
select {
  font: inherit;
}

.app-shell {
  max-width: 1760px;
  margin: 0 auto;
  padding: 26px 34px 72px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  padding: 10px 4px 4px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.03em;
  box-shadow: none;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 34px);
  font-weight: 650;
  letter-spacing: -0.045em;
}

.topbar-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.internal-tag,
.data-status {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  padding: 9px 13px;
}

.internal-tag {
  background: #1d1d1f;
  color: #fff;
  font-weight: 700;
}

.main-nav {
  position: sticky;
  top: 10px;
  z-index: 25;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 20px;
  padding: 6px;
  border: 0;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.06);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.nav-button,
.segmented button,
.agent-chip {
  border: 0;
  cursor: pointer;
  transition: 160ms ease;
}

.nav-button {
  min-width: 150px;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  padding: 12px 20px;
  font-weight: 700;
}

.nav-button:hover,
.nav-button:focus-visible {
  background: #f5f5f7;
  color: var(--ink);
}

.nav-button.active {
  background: var(--ink);
  color: #fff;
  box-shadow: none;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 34px 4px 20px;
}

.page-heading h2 {
  margin: 0 0 5px;
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 650;
  letter-spacing: -0.045em;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.toolbar,
.toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar {
  justify-content: flex-end;
}

.toolbar-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 0;
  border-radius: 13px;
  background: #e8e8ed;
}

.segmented button,
.agent-chip {
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
}

.segmented button.active,
.agent-chip.active {
  background: var(--ink);
  color: #fff;
}

.select-control {
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 9px 34px 9px 12px;
}

.dashboard-filters {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(520px, 1.4fr);
  gap: 12px;
  margin-bottom: 20px;
}

.filter-block {
  display: flex;
  min-height: 68px;
  align-items: center;
  gap: 14px;
  border: 0;
  border-radius: 20px;
  background: #fff;
  padding: 11px 14px;
  box-shadow: var(--shadow);
}

.filter-label {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.week-filter .multi-select {
  position: relative;
  min-width: 0;
  flex: 1;
}

.multi-select-toggle {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  font-size: 13px;
  text-align: left;
}

.multi-select-toggle:hover,
.multi-select-toggle[aria-expanded="true"] {
  background: #f5f8fc;
  color: var(--ink);
}

.chevron {
  color: var(--muted);
  font-size: 17px;
}

.multi-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: min(430px, calc(100vw - 48px));
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
}

.multi-select-tip {
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  padding: 12px 14px;
  font-size: 12px;
}

.multi-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
}

.multi-option {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  cursor: pointer;
  padding: 8px 9px;
  color: var(--ink);
  font-size: 12px;
}

.multi-option:hover {
  background: #f3f7ff;
}

.multi-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.multi-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line-soft);
  padding: 10px 12px;
}

.ghost-button,
.primary-button {
  cursor: pointer;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.primary-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
}

.agent-filter-block {
  align-items: center;
}

.agent-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

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

.component {
  grid-column: span 12;
  min-width: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.component.half {
  grid-column: span 6;
}

.component.third {
  grid-column: span 4;
}

.component-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 26px 28px 0;
}

.component-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.component-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.component-body {
  min-height: 100px;
  padding: 20px 28px 28px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
}

.kpi-grid.seven {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.kpi-grid.six {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
}

.goods-overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
}

.goods-summary-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(108px, 1fr));
  grid-auto-rows: minmax(100px, auto);
  gap: 10px;
}

.status-metric {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  border: 0;
  border-radius: 18px;
  background: #f5f5f7;
  padding: 16px 14px;
}

.status-metric.report-metric {
  grid-row: span 2;
}

.status-metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.status-metric strong {
  margin-top: 7px;
  color: var(--ink);
  font-size: clamp(20px, 1.8vw, 28px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
  font-weight: 650;
}

.status-metric small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0;
}

.status-rule-panel {
  border-radius: 20px;
  background: #f5f5f7;
  padding: 20px;
}

.status-rule-heading {
  margin-bottom: 10px;
}

.status-rule-heading span {
  display: block;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.status-rule-heading small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.status-rule-list {
  display: grid;
}

.status-rule-row {
  display: grid;
  grid-template-columns: 8px 52px 1fr;
  align-items: start;
  gap: 8px;
  border-top: 1px solid #dedee3;
  padding: 8px 0;
  font-size: 11px;
  line-height: 1.45;
}

.status-rule-row i {
  width: 7px;
  height: 7px;
  margin-top: 4px;
  border-radius: 50%;
}

.status-rule-row strong {
  color: var(--ink);
  font-weight: 650;
}

.status-rule-row span {
  color: var(--muted);
}

.kpi-card {
  position: relative;
  min-height: 112px;
  overflow: hidden;
  border: 0;
  border-radius: 20px;
  background: #f5f5f7;
  padding: 18px;
}

.kpi-card::after {
  display: none;
}

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

.kpi-value {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 650;
  letter-spacing: -0.04em;
}

.kpi-unit,
.kpi-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.kpi-note {
  display: block;
  margin-top: 6px;
}

.chart {
  position: relative;
  min-height: 290px;
}

.chart.small {
  min-height: 230px;
}

.chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-color: #bbc7d4 transparent;
  scrollbar-width: thin;
}

.chart svg {
  display: block;
  min-width: 100%;
  overflow: visible;
}

.chart-gridline {
  stroke: #e8edf2;
  stroke-width: 1;
}

.chart-axis-label {
  fill: #7b8794;
  font-size: 11px;
}

.chart-x-label {
  fill: #687583;
  font-size: 11px;
}

.chart-value-label {
  font-size: 9px;
  font-weight: 700;
}

.chart-bar {
  cursor: pointer;
  opacity: 0.92;
  transition: opacity 120ms ease;
}

.chart-bar:hover {
  opacity: 1;
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.chart-dot {
  cursor: pointer;
  stroke: #fff;
  stroke-width: 2;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.share-list {
  display: grid;
  gap: 13px;
}

.share-row {
  display: grid;
  grid-template-columns: 64px 1fr 74px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.share-track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f5;
}

.share-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
}

.share-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.plan-week-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.plan-week-card {
  border-radius: 18px;
  background: #f5f5f7;
  padding: 14px;
}

.plan-week-card > span {
  display: block;
  margin-bottom: 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 650;
}

.plan-week-card > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.plan-week-card > div strong {
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ratio-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.ratio-chip {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #f8faff;
  padding: 12px 14px;
}

.ratio-chip strong {
  display: block;
  margin-top: 5px;
  color: var(--blue);
  font-size: 20px;
}

.rule-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
}

.rule-item {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fbfcfe;
  padding: 13px 14px;
}

.rule-item strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.rule-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.empty-state,
.error-panel,
.loading-panel {
  display: grid;
  min-height: 300px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
}

.empty-state.compact {
  min-height: 210px;
  align-content: center;
  gap: 8px;
  border: 0;
  background: transparent;
  font-size: 12px;
}

.empty-icon {
  width: 78px;
  height: 62px;
  opacity: 0.88;
}

.error-panel {
  color: #a83b44;
  padding: 30px;
}

.loader {
  width: 34px;
  height: 34px;
  border: 3px solid #dbe5f2;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.chart-tooltip {
  position: fixed;
  z-index: 100;
  display: none;
  max-width: 260px;
  pointer-events: none;
  border-radius: 10px;
  background: rgba(20, 35, 51, 0.95);
  color: #fff;
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(12, 24, 37, 0.2);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1180px) {
  .dashboard-filters {
    grid-template-columns: 1fr;
  }

  .kpi-grid,
  .kpi-grid.seven,
  .kpi-grid.six {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .goods-overview-layout {
    grid-template-columns: 1fr;
  }

  .plan-week-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .rule-list {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .goods-summary-grid {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .status-metric.report-metric {
    grid-row: span 1;
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 20px 16px 40px;
  }

  .topbar,
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-meta,
  .toolbar {
    justify-content: flex-start;
  }

  .component.half,
  .component.third {
    grid-column: span 12;
  }

  .kpi-grid,
  .kpi-grid.seven,
  .kpi-grid.six {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .goods-summary-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 520px) {
  .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 13px;
  }

  .data-status {
    display: none;
  }

  .nav-button {
    min-width: 128px;
  }

  .component-header,
  .component-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .kpi-grid,
  .kpi-grid.seven,
  .kpi-grid.six,
  .rule-list,
  .goods-summary-grid,
  .plan-week-grid {
    grid-template-columns: 1fr;
  }

  .filter-block {
    align-items: flex-start;
    flex-direction: column;
  }

  .week-filter .multi-select {
    width: 100%;
  }

  .multi-options {
    grid-template-columns: 1fr;
  }
}
