:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d8e0ee;
  --blue: #244ba8;
  --blue-dark: #173477;
  --blue-soft: #eef4ff;
  --green: #047857;
  --red: #b42318;
  --orange: #c2410c;
  --shadow: 0 12px 28px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

button,
select {
  font: inherit;
}

button {
  color: inherit;
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

.workspace-shell {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.app-header h1 {
  margin-top: 4px;
  font-size: 28px;
  line-height: 1.2;
}

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.definition-pill {
  max-width: 520px;
  border: 1px solid #b7c8f4;
  border-radius: 999px;
  padding: 10px 16px;
  background: #fff;
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
}

.summary-strip {
  display: grid;
  grid-template-columns: 1.3fr repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card,
.panel,
.filter-panel,
.product-hero,
.mini-kpi,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.kpi-card {
  min-height: 128px;
  padding: 18px;
}

.kpi-card.primary {
  background: var(--blue);
  color: #fff;
}

.kpi-card.alert strong {
  color: var(--red);
}

.kpi-card span,
.mini-kpi span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.kpi-card.primary span,
.kpi-card.primary p {
  color: rgba(255, 255, 255, 0.82);
}

.kpi-card strong {
  display: block;
  margin-top: 14px;
  color: var(--blue-dark);
  font-size: 34px;
  line-height: 1;
}

.kpi-card.primary strong {
  color: #fff;
  font-size: 42px;
}

.kpi-card p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.main-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
}

.panel {
  padding: 20px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-heading h2,
.filter-panel h2,
.product-hero h2 {
  margin-top: 5px;
  font-size: 20px;
  line-height: 1.35;
}

.mini-badge {
  border-radius: 999px;
  padding: 7px 11px;
  background: #e9f9f2;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.rank-table,
.bar-list,
.detail-list,
.reason-list {
  display: grid;
  gap: 9px;
}

.rank-table,
.detail-list,
.reason-list {
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.rank-head,
.rank-row {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) 74px 74px 104px 74px;
  gap: 10px;
  align-items: center;
}

.rank-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 12px;
  border-radius: 8px;
  background: #eef2f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rank-row {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px;
  background: #f7f9fd;
  cursor: pointer;
  text-align: left;
}

.rank-row:hover,
.rank-row.selected {
  border-color: #7795e8;
  background: var(--blue-soft);
}

.rank-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-row span,
.rank-row em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  text-align: right;
}

.rank-row em {
  color: var(--blue-dark);
}

.bar-row {
  display: grid;
  gap: 7px;
  border-radius: 8px;
  padding: 3px;
}

.clickable .bar-row {
  padding: 10px;
  cursor: pointer;
}

.clickable .bar-row:hover,
.bar-row.active {
  background: var(--blue-soft);
}

.bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 800;
}

.bar-top strong {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f7;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 250px 250px;
  gap: 18px;
  align-items: end;
  margin-top: 18px;
  padding: 20px;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

select {
  width: 100%;
  height: 48px;
  border: 1px solid #c8d3e5;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  outline: none;
}

select:focus {
  border-color: #6d8fe2;
  box-shadow: 0 0 0 3px rgba(109, 143, 226, 0.18);
}

.empty-state {
  margin-top: 18px;
  padding: 24px;
  color: var(--muted);
  line-height: 1.7;
}

.empty-state.compact {
  margin-top: 0;
  padding: 14px;
  box-shadow: none;
  background: #f7f9fd;
}

.product-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
  margin-top: 18px;
}

.product-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 18px;
  align-items: center;
  grid-column: 1 / -1;
  padding: 24px;
  background: linear-gradient(135deg, #173477 0%, #244ba8 100%);
  color: #fff;
}

.product-hero .eyebrow,
.product-hero p {
  color: rgba(255, 255, 255, 0.82);
}

.product-hero p {
  margin-top: 10px;
  line-height: 1.75;
}

.product-hero strong {
  color: #fff;
}

.product-rate {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.product-rate span {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 800;
}

.product-rate strong {
  display: block;
  margin-top: 10px;
  font-size: 38px;
  line-height: 1;
}

.product-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  grid-column: 1 / -1;
}

.mini-kpi {
  padding: 16px;
}

.mini-kpi strong {
  display: block;
  margin-top: 10px;
  color: var(--blue-dark);
  font-size: 28px;
}

.mini-kpi.muted strong {
  color: var(--muted);
}

.single-categories,
.action-panel {
  min-height: 260px;
}

.advice-text {
  color: #344054;
  font-size: 16px;
  line-height: 1.8;
}

.detail-panel,
.reason-panel {
  min-height: 420px;
}

.detail-panel {
  grid-column: 1 / -1;
}

.reason-panel {
  grid-column: 1 / -1;
}

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

.reason-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.8fr);
  gap: 18px;
}

.detail-row,
.reason-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  border-radius: 8px;
  padding: 12px 13px;
  background: #f7f9fd;
}

.reason-row {
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
}

.reason-row:hover,
.reason-row.active {
  border-color: #7795e8;
  background: var(--blue-soft);
}

.detail-row strong,
.reason-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-row span,
.reason-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .main-layout,
  .product-layout,
  .reason-grid {
    grid-template-columns: 1fr;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .filter-panel {
    grid-template-columns: 1fr 1fr;
  }

  .filter-panel > div {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .workspace-shell {
    width: min(100% - 24px, 760px);
    padding-top: 18px;
  }

  .app-header,
  .product-hero {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-strip,
  .filter-panel,
  .product-kpis {
    grid-template-columns: 1fr;
  }

  .rank-head,
  .rank-row {
    grid-template-columns: minmax(82px, 1fr) 62px 62px 88px 62px;
    gap: 6px;
    font-size: 12px;
  }
}
