* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f5f7fb;
  color: #1f2933;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 28px;
  background: #ffffff;
  border-bottom: 1px solid #dde3ea;
}

.topbar p {
  margin: 0 0 4px;
  color: #637083;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

.workspace {
  display: grid;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px;
}

.query-panel,
.table-panel {
  background: #ffffff;
  border: 1px solid #dde3ea;
  border-radius: 8px;
}

.table-panel {
  overflow-x: auto;
}

.query-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 16px;
}

.query-form label {
  display: grid;
  gap: 6px;
  flex: 1 1 180px;
  color: #52616f;
  font-size: 13px;
}

.query-form input,
.query-form select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #c9d3df;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2933;
  font-size: 14px;
}

button {
  height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: #1769aa;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
}

button:hover {
  background: #125482;
}

button:disabled {
  background: #9aa8b7;
  cursor: default;
}

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

.metric {
  min-height: 112px;
  padding: 18px;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  background: #ffffff;
}

.metric span {
  display: block;
  margin-bottom: 12px;
  color: #65758b;
  font-size: 13px;
}

.metric strong {
  display: block;
  color: #0f766e;
  font-size: 30px;
  line-height: 1.2;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #e5eaf0;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.panel-head span,
.state {
  color: #65758b;
}

.state {
  padding: 14px 16px;
}

.state:empty {
  display: none;
}

.state.error {
  color: #b42318;
  background: #fff1f0;
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #e5eaf0;
  text-align: right;
}

th {
  color: #52616f;
  font-size: 13px;
  font-weight: 700;
}

td {
  font-size: 14px;
  vertical-align: middle;
}

th:nth-child(1),
td:nth-child(1) {
  width: 92px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 118px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 142px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 62px;
}

th:nth-child(5),
td:nth-child(5) {
  width: 76px;
}

th:nth-child(6),
td:nth-child(6) {
  width: 82px;
}

th:nth-child(7),
td:nth-child(7),
th:nth-child(8),
td:nth-child(8) {
  width: 84px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.merchant-cell {
  display: grid;
  grid-template-columns: minmax(0, max-content) 40px;
  align-items: center;
  justify-content: end;
  gap: 8px;
  min-width: 0;
  text-align: right;
}

.merchant-cell img {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: #edf1f5;
}

.merchant-cell strong {
  display: block;
  max-width: 8em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.time-cell {
  display: grid;
  gap: 2px;
  justify-items: end;
  min-width: 0;
}

.time-cell strong,
.time-cell small {
  line-height: 1.3;
  white-space: nowrap;
}

.time-cell small {
  color: #65758b;
  font-size: 12px;
}

.user-cell {
  display: grid;
  grid-template-columns: minmax(0, max-content) 34px;
  align-items: center;
  justify-content: end;
  gap: 8px;
  min-width: 0;
  text-align: right;
}

.user-cell img {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: #edf1f5;
}

.user-cell strong {
  display: block;
  max-width: 6em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.user-cell small {
  display: block;
  margin-top: 2px;
  color: #65758b;
  font-size: 12px;
  line-height: 1.3;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  background: #edf1f5;
  color: #425466;
  font-size: 13px;
}

.activity-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  background: #edf1f5;
  color: #425466;
  font-size: 13px;
}

.activity-1 {
  background: #eef6ff;
  color: #1769aa;
}

.activity-2 {
  background: #fff4e5;
  color: #b54708;
}

.status-7,
.status-100 {
  background: #e7f8f2;
  color: #0f766e;
}

.commission-cell {
  display: grid;
  gap: 4px;
  justify-items: end;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  padding: 14px 16px;
  border-top: 1px solid #e5eaf0;
  color: #52616f;
  font-size: 14px;
}

.pager button {
  min-width: 76px;
  padding: 0 12px;
}

.page-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-size select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid #c9d3df;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2933;
}

.commission-cell strong {
  font-size: 15px;
  line-height: 1.2;
}

.commission-cell small {
  color: #65758b;
  font-size: 12px;
  line-height: 1.2;
}

@media (max-width: 760px) {
  .topbar,
  .query-form,
  .panel-head {
    display: block;
  }

  .query-form label,
  .query-form button {
    margin-top: 12px;
  }

  .query-form button {
    width: 100%;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .table-panel {
    overflow-x: auto;
  }

  table {
    min-width: 980px;
  }
}
