:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "PingFang SC", Arial, sans-serif;
  background: #f4f6f8;
  color: #17212b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f4f6f8;
}

.app {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

p {
  margin: 0;
}

#pageCode {
  margin-top: 4px;
  color: #667280;
  font-size: 13px;
}

.badge {
  flex: 0 0 auto;
  min-width: 74px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.badge.online {
  background: #dff5e8;
  color: #146c3d;
}

.badge.offline {
  background: #ffe5e2;
  color: #a72b1d;
}

.statusGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.statusGrid > div,
.composer,
.history,
.notice {
  background: #fff;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
}

.statusGrid > div {
  padding: 12px;
}

.statusGrid span {
  display: block;
  color: #667280;
  font-size: 12px;
  margin-bottom: 5px;
}

.statusGrid strong {
  display: block;
  min-height: 21px;
  font-size: 15px;
  word-break: break-all;
}

.notice {
  padding: 12px;
  margin-bottom: 14px;
  background: #fff8e1;
  border-color: #ecd37c;
  color: #6e5600;
}

.hidden {
  display: none;
}

.composer {
  padding: 14px;
  margin-bottom: 14px;
}

label {
  display: block;
  color: #4c5967;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

input,
textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid #cfd7df;
  border-radius: 6px;
  padding: 10px;
  font: inherit;
  color: #17212b;
  background: #fff;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

input:focus,
textarea:focus {
  border-color: #2970cc;
  box-shadow: 0 0 0 3px rgba(41, 112, 204, 0.13);
}

button {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 6px;
  background: #1769d2;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  background: #9aa7b4;
  cursor: not-allowed;
}

.hint {
  min-height: 20px;
  margin-top: 9px;
  font-size: 13px;
  color: #667280;
}

.hint.error {
  color: #b3261e;
}

.hint.ok {
  color: #146c3d;
}

.history {
  padding: 12px;
}

.sectionTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

h2 {
  margin: 0;
  font-size: 17px;
}

#historyCount {
  color: #667280;
  font-size: 13px;
}

.historyList {
  display: grid;
  gap: 8px;
}

.message {
  border: 1px solid #e4e9ef;
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.messageTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.name {
  font-weight: 700;
  color: #17212b;
}

.time {
  color: #7c8794;
  font-size: 12px;
  white-space: nowrap;
}

.text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  color: #293542;
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #667280;
  font-size: 12px;
}

.status {
  border-radius: 4px;
  padding: 2px 6px;
  background: #edf1f5;
  color: #4c5967;
}

.status.started {
  background: #dff5e8;
  color: #146c3d;
}

.status.failed {
  background: #ffe5e2;
  color: #a72b1d;
}

.status.received {
  background: #e5f0ff;
  color: #1c5ca8;
}

@media (max-width: 640px) {
  .app {
    padding: 12px;
  }

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

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

  h1 {
    font-size: 22px;
  }
}
