:root {
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: #f5f7fb;
  color: #172033;
  font-size: 15px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

html:has(.login-page),
body.login-page {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid #d5dfed;
  border-radius: 7px;
  background: #fff;
  color: #243247;
  padding: 0 13px;
  cursor: pointer;
}

button:disabled {
  opacity: .62;
  cursor: wait;
}

.primary {
  border-color: #1e63d6;
  background: #1e63d6;
  color: #fff;
}

.app {
  width: min(1440px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 22px 0 38px;
}

.topbar,
.panel-head,
.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.row-actions {
  justify-content: center;
  display: grid;
  grid-template-columns: repeat(2, 56px);
  gap: 8px;
}

.row-actions button {
  min-height: 36px;
  padding: 0;
}

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 19px;
}

p {
  margin-top: 7px;
  color: #647084;
  font-size: 14px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px 0 16px;
}

.metrics div {
  min-height: 82px;
  padding: 15px;
  border: 1px solid #dde5ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(31, 45, 68, .05);
}

.metrics span {
  display: block;
  color: #738095;
  font-size: 13px;
}

.metrics b {
  display: block;
  margin-top: 8px;
  font-size: 25px;
}

.panel {
  background: #fff;
  border: 1px solid #dde5f0;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(31, 45, 68, .08);
  overflow: hidden;
}

.panel-head {
  padding: 17px 20px;
  border-bottom: 1px solid #e5ebf4;
}

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(520px, 55vw);
}

.filters input {
  min-width: 0;
  flex: 1;
}

.filters select {
  width: 132px;
  flex: none;
}

.table-wrap {
  overflow: auto;
}

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

th:nth-child(1),
td:nth-child(1) {
  width: 17%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 9%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 8%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 8%;
}

th:nth-child(5),
td:nth-child(5) {
  width: 37%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 8%;
}

th:nth-child(7),
td:nth-child(7) {
  width: 13%;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid #edf1f6;
  text-align: center;
  vertical-align: middle;
  font-size: 15px;
}

th {
  padding-top: 14px;
  padding-bottom: 14px;
  background: #f7f9fc;
  color: #526074;
  font-size: 15px;
  font-weight: 800;
}

td strong,
td .muted {
  display: block;
  overflow-wrap: anywhere;
}

td:nth-child(1) {
  text-align: left;
  padding-left: 24px;
}

th:nth-child(1) {
  text-align: left;
  padding-left: 24px;
}

td:nth-child(2),
td:nth-child(3),
td:nth-child(6),
td:nth-child(7) {
  white-space: nowrap;
}

.muted {
  margin-top: 5px;
  color: #768397;
  font-size: 12px;
  line-height: 1.45;
}

.badge,
.group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef4ff;
  color: #255db7;
  font-size: 13px;
}

.ok {
  background: #e9f8ef;
  color: #257447;
}

.error {
  background: #ffeded;
  color: #b73636;
}

.groups {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 7px;
  max-width: none;
}

td:nth-child(5) {
  text-align: left;
}

th:nth-child(5) {
  text-align: center;
}

td:nth-child(2) {
  color: #526074;
  font-size: 14px;
  overflow-wrap: anywhere;
  white-space: normal;
  text-align: left;
  padding-left: 8px;
}

th:nth-child(2) {
  text-align: left;
  padding-left: 8px;
}

.group {
  gap: 7px;
  border-radius: 7px;
  background: #fbfdff;
  border: 1px solid #d9e3ef;
  color: #172033;
  max-width: 100%;
}

.group b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(360px, 100%);
}

.group em {
  color: #255db7;
  font-style: normal;
}

.empty {
  padding: 32px;
  color: #768397;
  text-align: center;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid #e5ebf4;
  color: #647084;
  font-size: 14px;
}

.pagination-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pagination-actions button {
  min-width: 42px;
}

.pagination-actions button.active {
  border-color: #1e63d6;
  background: #1e63d6;
  color: #fff;
}

.page-ellipsis {
  min-width: 22px;
  color: #768397;
  text-align: center;
}

dialog {
  width: min(640px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 22px 70px rgba(20, 30, 46, .28);
}

dialog::backdrop {
  background: rgba(18, 28, 45, .45);
}

#siteForm {
  padding: 0;
}

.dialog-head {
  padding: 20px 24px;
  border-bottom: 1px solid #e5ebf4;
}

#closeDialogButton {
  width: 42px;
  padding: 0;
  font-size: 22px;
}

#siteForm label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 24px 0;
  color: #526074;
  font-size: 15px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cad4e2;
  border-radius: 7px;
  color: #172033;
  padding: 9px 12px;
  outline: none;
}

textarea {
  min-height: 82px;
  resize: vertical;
  font-family: Consolas, "Microsoft YaHei", monospace;
  line-height: 1.45;
}

.dialog-error {
  min-height: 20px;
  margin: 14px 24px 0;
  color: #b73636;
  font-size: 14px;
  line-height: 1.45;
}

.dialog-actions {
  justify-content: flex-end;
  padding: 18px 24px 24px;
}

@media (max-width: 760px) {
  .app {
    width: min(100vw - 20px, 1360px);
    padding-top: 14px;
  }

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

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .filters {
    width: 100%;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .top-actions,
  .top-actions button {
    width: 100%;
  }
}

.login-page {
  min-height: 100dvh;
  background: #f5f7fb;
  padding: 0;
}

.login-card {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid #dde5f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(31, 45, 68, .08);
}

.login-card form {
  margin-top: 20px;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  color: #526074;
}

.login-card button {
  width: 100%;
  margin-top: 14px;
}
