:root {
  color-scheme: light;
  --ink: #1b2533;
  --muted: #647084;
  --line: #d9e0ea;
  --panel: #ffffff;
  --page: #f4f7fb;
  --blue: #2563eb;
  --teal: #0f9f8e;
  --amber: #d9822b;
  --red: #d64545;
  --green: #18875b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 36px 22px;
  background: #111827;
  color: #fff;
}

.eyebrow {
  margin: 0 0 8px;
  color: #8bd8cb;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.25;
}

h2 {
  font-size: 16px;
  line-height: 1.35;
}

.meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 6px;
  color: #cbd5e1;
  white-space: nowrap;
}

main {
  width: min(1480px, calc(100% - 40px));
  margin: 20px auto 40px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.filter-control {
  position: relative;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.multi-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.multi-trigger::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid #647084;
  border-bottom: 2px solid #647084;
  transform: rotate(45deg) translateY(-2px);
}

.multi-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  display: none;
  width: min(460px, 92vw);
  max-height: 380px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.filter-control.open .multi-menu {
  display: block;
}

.multi-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 34px;
  padding: 8px 9px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
}

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

.multi-option input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  flex: 0 0 auto;
}

.multi-option.all {
  position: sticky;
  top: -8px;
  z-index: 1;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  font-weight: 800;
}

.multi-empty {
  padding: 12px 8px;
  color: var(--muted);
  font-weight: 500;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.kpi,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.kpi {
  padding: 15px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 23px;
  line-height: 1.2;
}

.kpi em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.75fr);
}

.grid.two.inside {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0;
}

.panel {
  padding: 16px;
}

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

.panel-head p,
.panel > p {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.chart {
  width: 100%;
  height: 320px;
}

.axis-label,
.tick {
  fill: #647084;
  font-size: 11px;
}

.bars {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 160px) 1fr minmax(70px, auto);
  align-items: center;
  gap: 10px;
}

.bar-label {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.bar-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.reason-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.reason {
  padding: 12px;
  border-left: 4px solid var(--teal);
  border-radius: 6px;
  background: #f3fbfa;
}

.reason strong {
  display: block;
  margin-bottom: 5px;
}

.reason p {
  color: #36535c;
  line-height: 1.55;
}

.table-wrap {
  overflow: auto;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.table-wrap.compact {
  max-height: 430px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #526073;
  font-size: 12px;
  white-space: nowrap;
}

td {
  line-height: 1.38;
}

td.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.tag-high {
  color: var(--red);
  font-weight: 700;
}

.tag-mid {
  color: var(--amber);
  font-weight: 700;
}

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

.advice-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.advice-card strong {
  display: block;
  margin-bottom: 7px;
}

.advice-card p {
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 980px) {
  .topbar {
    flex-direction: column;
    padding: 24px 20px;
  }

  .meta {
    align-items: flex-start;
  }

  main {
    width: min(100% - 24px, 1480px);
  }

  .filters,
  .kpis,
  .grid.two,
  .grid.two.inside,
  .advice {
    grid-template-columns: 1fr;
  }

  .chart {
    height: 280px;
  }
}
