:root {
  color-scheme: light;
  --page-bg: #eef0f3;
  --panel-bg: #ffffff;
  --panel-border: #d8dee8;
  --text: #1f2733;
  --muted: #69717d;
  --accent: #1877f2;
  --wechat: #10b567;
  --archive-bg: #f7f8fa;
  --archive-line: #e3e6eb;
  --left-bubble: #ffffff;
  --right-bubble: #c9e7ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC",
    Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--panel-border);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.feedback-app {
  display: grid;
  grid-template-columns: minmax(240px, 268px) minmax(420px, 1fr);
  gap: 16px;
  width: min(1220px, calc(100vw - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
}

.record-sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px;
  border: 1px solid #dce2ea;
  border-radius: 8px;
  background: #eef3f8;
  box-shadow: 0 10px 24px rgba(31, 38, 49, 0.06);
}

.chat-panel {
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--archive-bg);
}

.chat-list-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-box::before {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 12px;
  height: 12px;
  border: 1.8px solid #7c8795;
  border-radius: 50%;
  transform: translateY(-55%);
  content: "";
  pointer-events: none;
}

.search-box::after {
  position: absolute;
  top: 23px;
  left: 23px;
  width: 6px;
  height: 1.8px;
  border-radius: 2px;
  background: #7c8795;
  transform: rotate(45deg);
  content: "";
  pointer-events: none;
}

.search-box span {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.search-box input {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px 0 34px;
  color: #1f2933;
  background: #dfe5ec;
}

.add-chat-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: #dfe5ec;
  color: #1f2933;
  font-size: 22px;
  line-height: 1;
}

.record-total {
  overflow: hidden;
  margin: 0;
  padding: 0 6px 2px;
  color: #8a94a3;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-list {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: auto;
}

.record-card {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 62px;
  padding: 7px 7px;
  border: 0;
  border-bottom: 1px solid #dde4ec;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  transition:
    background-color 120ms ease,
    color 120ms ease;
}

.record-card:hover,
.record-card.is-active {
  background: #408cf5;
  color: #ffffff;
}

.record-avatar {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 5px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
}

.avatar-0 { background: linear-gradient(135deg, #59b56d, #277e45); }
.avatar-1 { background: linear-gradient(135deg, #5d91d8, #3858b8); }
.avatar-2 { background: linear-gradient(135deg, #d59665, #a65730); }
.avatar-3 { background: linear-gradient(135deg, #61a6a8, #2f7178); }
.avatar-4 { background: linear-gradient(135deg, #ba7ac8, #7045a7); }
.avatar-5 { background: linear-gradient(135deg, #d8708b, #9b3859); }
.avatar-6 { background: linear-gradient(135deg, #7c8fa3, #4d5d70); }
.avatar-7 { background: linear-gradient(135deg, #d4b14f, #9c7621); }

.record-card-body {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.record-card-head {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.record-card strong {
  display: block;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-card-time {
  flex: 0 0 auto;
  color: #8a94a3;
  font-size: 11px;
  line-height: 1;
}

.record-preview {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #8a94a3;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-card.is-active .record-card-time,
.record-card.is-active .record-preview,
.record-card:hover .record-card-time,
.record-card:hover .record-preview {
  color: rgba(255, 255, 255, 0.82);
}

.archive-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-bottom: 1px solid var(--archive-line);
  background: var(--archive-bg);
}

.archive-head strong {
  color: #111111;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.archive-head button {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #8d949e;
  font-size: 18px;
  line-height: 1;
}

.chat-stage {
  max-height: calc(100vh - 70px);
  overflow: auto;
  background: var(--archive-bg);
}

.archive-date {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 42px;
  color: #9aa3ad;
  font-size: 13px;
}

.archive-date::before,
.archive-date::after {
  width: min(168px, 28%);
  height: 1px;
  background: var(--archive-line);
  content: "";
}

.chat-surface {
  width: 100%;
  min-height: 640px;
  overflow: visible;
  background: transparent;
}

.message-list {
  display: flex;
  min-height: 640px;
  flex-direction: column;
  gap: 12px;
  padding: 0 22px 28px;
  font-size: 14px;
}

.archive-message {
  display: flex;
  flex-direction: column;
  max-width: min(76%, 560px);
}

.archive-message.has-media {
  max-width: min(76%, 320px);
}

.archive-message.left {
  align-self: flex-start;
}

.archive-message.right {
  align-self: flex-end;
  align-items: flex-end;
}

.archive-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  color: #9aa3ad;
  font-size: 12px;
  line-height: 1.35;
}

.archive-message.right .archive-meta {
  justify-content: flex-end;
}

.masked-name {
  color: #6f7c8a;
}

.wechat-source {
  color: var(--wechat);
}

.message-time {
  color: #9aa3ad;
}

.archive-body {
  margin-top: 5px;
  padding: 9px 11px;
  border-radius: 6px;
  background: var(--left-bubble);
  color: #000000;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

.archive-message.has-media .archive-body {
  width: fit-content;
  max-width: 100%;
}

.archive-message.right .archive-body {
  background: var(--right-bubble);
}

.inline-emoji {
  display: inline-block;
  margin: 0 1px;
  vertical-align: -6px;
}

.media-bubble {
  display: flex;
  width: var(--media-width, fit-content);
  max-width: min(100%, 280px);
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.video-bubble {
  width: min(100%, 220px);
  max-width: 220px;
}

.video-bubble.portrait {
  width: min(100%, 180px);
  max-width: 180px;
}

.media-bubble img,
.media-bubble video {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 320px;
  border-radius: 4px;
  background: #111820;
  object-fit: cover;
}

.media-bubble img {
  background: #dce2ea;
}

.media-bubble video {
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
}

.media-caption {
  color: #69717d;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.builtin-sticker {
  width: 72px;
  height: 72px;
  background-image: url("assets/wechat-emoji-sprite.png");
  background-position: 0 -5688px;
  background-repeat: no-repeat;
  background-size: 72px 10656px;
}

.empty-state {
  padding: 20px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.media-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(14, 20, 28, 0.78);
}

.media-modal[hidden] {
  display: none;
}

.modal-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-color: rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
}

.modal-body {
  display: grid;
  max-width: min(96vw, 1180px);
  max-height: 92vh;
  place-items: center;
}

.modal-body img,
.modal-body video {
  max-width: 100%;
  max-height: 92vh;
  border-radius: 8px;
  background: #111820;
  object-fit: contain;
}

@media (max-width: 860px) {
  .feedback-app {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 620px);
  }

  .chat-stage {
    max-height: none;
  }
}

@media (max-width: 520px) {
  .feedback-app {
    width: 100%;
    min-height: 100vh;
    margin: 0;
  }

  .record-sidebar,
  .chat-panel {
    border-radius: 0;
  }

  .message-list {
    padding: 0 16px 24px;
  }

  .media-bubble {
    max-width: min(100%, 260px);
  }

  .archive-message {
    max-width: 86%;
  }
}
