:root {
  --bg: #f6f7f3;
  --ink: #1e2528;
  --muted: #647074;
  --panel: #ffffff;
  --line: #dfe4de;
  --accent: #157f78;
  --accent-2: #b54838;
  --warn: #c28a20;
  --good: #24865b;
  --bad: #b33d3d;
  --bad-bg: #fff1ef;
  --warn-bg: #fff8e8;
  --shadow: 0 12px 28px rgba(30, 37, 40, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcf8;
}

h1 { margin: 3px 0 8px; font-size: 28px; letter-spacing: 0; }
.eyebrow { margin: 0; color: var(--accent); font-weight: 700; }
.subline, .source { color: var(--muted); font-size: 13px; }
.source { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 5px; }

main { padding: 20px 32px 40px; }

.filters {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 12px;
  margin: -20px -32px 18px;
  padding: 20px 32px 18px;
  background: rgba(246, 247, 243, .96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(30, 37, 40, .08);
  backdrop-filter: blur(8px);
}

.filter {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.filter button {
  width: 100%;
  min-height: 48px;
  padding: 9px 34px 9px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.filter button::after {
  content: "⌄";
  position: absolute;
  right: 13px;
  top: 12px;
  color: var(--muted);
}

.filter-label { display: block; font-size: 12px; color: var(--muted); }
.filter-value { display: block; margin-top: 3px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu {
  display: none;
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 330px;
  overflow: auto;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(30, 37, 40, .16);
}
.filter.open .menu { display: block; }
.menu label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 7px 6px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.menu label:hover { background: #eef6f3; }
.menu .all { border-bottom: 1px solid var(--line); margin-bottom: 4px; font-weight: 700; }

.summary { display: grid; grid-template-columns: .95fr 2.05fr; gap: 14px; align-items: start; }
.summary-card, .group-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.summary-card { padding: 16px; }
.summary-card.total { min-height: 164px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(240px, 1fr)); gap: 10px; }
.summary-card.critical { border-color: #e5b0a7; background: linear-gradient(180deg, #fff8f6 0%, #fff 58%); }
.summary-card.watch { border-color: #ebd19a; background: linear-gradient(180deg, #fffaf0 0%, #fff 58%); }

.metric-title { color: var(--muted); font-size: 13px; }
.metric-main { margin-top: 5px; font-size: 30px; font-weight: 800; }
.metric-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.mini { padding: 8px 9px; background: #f7f9f7; border-radius: 6px; }
.mini b { display: block; font-size: 16px; margin-top: 3px; }

.bar { height: 8px; margin-top: 10px; background: #e7ebe5; border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); min-width: 2px; }
.bar.danger span { background: var(--bad); }
.bar.watch span { background: var(--warn); }

.gap-panel {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.gap-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}
.gap-list { display: grid; gap: 7px; }
.gap-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 6px;
  background: #f7f9f7;
}
.gap-item.critical { background: var(--bad-bg); }
.gap-item.watch { background: var(--warn-bg); }
.gap-name { min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap-meta { margin-top: 2px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap-value { font-weight: 900; color: var(--bad); white-space: nowrap; }

.groups { display: grid; gap: 16px; margin-top: 18px; }
.group-block { overflow: hidden; }
.group-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px 12px;
  background: #fbfcf8;
  border-bottom: 1px solid var(--line);
}
.group-head h2 { margin: 0 0 5px; font-size: 18px; }
.group-head p { margin: 0; color: var(--muted); font-size: 13px; }
.badge { align-self: center; padding: 6px 9px; border-radius: 999px; background: #e6f3f0; color: #0f625d; font-weight: 800; }
.badge.critical { background: #ffe4df; color: var(--bad); }
.badge.watch { background: #fff0c7; color: #8a5a00; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  text-align: left;
  background: #fafbf8;
  font-weight: 700;
}
tbody tr { position: relative; }
tbody tr.critical { background: var(--bad-bg); }
tbody tr.watch { background: var(--warn-bg); }
tbody tr.critical td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
tbody tr.watch td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
tbody tr:hover { background: #eef6f3; }
td.num, th.num { text-align: left; }
.product {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 700;
  line-height: 1.35;
}
.muted { color: var(--muted); font-size: 12px; }
.rate { font-weight: 800; }
.rate.good { color: var(--good); }
.rate.warn { color: var(--warn); }
.rate.bad { color: var(--bad); }
.gap-cell { font-weight: 900; }
.gap-cell.critical { color: var(--bad); }
.gap-cell.watch { color: #8a5a00; }
.tag {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}
.tag.critical { background: #ffd9d2; color: var(--bad); }
.tag.watch { background: #ffe7a8; color: #8a5a00; }
.site-cell { color: #24383d; font-weight: 700; }
.identity-cell { color: var(--muted); font-size: 12px; line-height: 1.45; }
.identity-cell b { display: block; color: var(--ink); font-size: 13px; font-weight: 700; }
.progress-cell { min-width: 150px; }
.inline-progress {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px;
  align-items: center;
}
.inline-progress .bar { margin: 0; height: 7px; }

@media (max-width: 1050px) {
  .topbar, main { padding-left: 18px; padding-right: 18px; }
  .filters { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
  .summary { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .topbar { flex-direction: column; }
  .source { align-items: flex-start; }
  .filters, .summary-grid { grid-template-columns: 1fr; }
  table { min-width: 900px; }
  .group-block { overflow-x: auto; }
}
