:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --brand: #1677ff;
  --ok: #138a43;
  --warn: #b25e09;
  --bad: #b42318;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  min-height: 42px;
  padding: 0 14px;
  cursor: pointer;
}

button.secondary,
.section-head button {
  background: #e9eef6;
  color: var(--text);
}

.icon-btn {
  width: 42px;
  padding: 0;
  background: #e9eef6;
  color: var(--text);
  font-size: 22px;
}

.shell {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 18px 14px 34px;
}

.toolbar,
.section-head,
.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar,
.section-head {
  justify-content: space-between;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

h2 {
  font-size: 18px;
}

.search-panel,
.list-section,
.summary-grid > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-panel {
  margin-top: 18px;
  padding: 14px;
}

.search-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.search-row input {
  min-width: 0;
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.summary-grid > div {
  padding: 12px;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.list-section {
  margin-top: 12px;
  padding: 14px;
}

.stats-list,
.records-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.empty {
  color: var(--muted);
  font-size: 14px;
}

.stat-item,
.record-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.stat-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.name {
  font-weight: 700;
}

.meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.count {
  font-size: 24px;
  font-weight: 800;
  color: var(--brand);
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 12px;
}

.badge.ok {
  background: #e8f6ee;
  color: var(--ok);
}

.badge.warn {
  background: #fff3df;
  color: var(--warn);
}

.badge.bad {
  background: #fff0ed;
  color: var(--bad);
}

.record-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

@media (min-width: 720px) {
  .shell {
    padding-top: 28px;
  }

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