:root {
  color-scheme: light;
  --bg: #edf1f4;
  --panel: #ffffff;
  --text: #18212b;
  --muted: #6b7581;
  --line: #d9e0e7;
  --accent: #177d72;
  --accent-2: #eeb84c;
  --danger: #c43f4d;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #f8fbfc 0, #edf1f4 36%, #e8ecef 100%);
  color: var(--text);
}

button, input, textarea { font: inherit; }

.customer-app {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--panel);
  display: grid;
  grid-template-rows: auto 1fr auto;
  box-shadow: 0 0 38px rgba(30, 43, 55, .12);
}

.chat-header {
  min-height: 64px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 2;
}

.chat-header strong {
  display: block;
  font-size: 18px;
  letter-spacing: 0;
}

.chat-header span {
  color: var(--muted);
  display: block;
  margin-top: 3px;
  font-size: 12px;
}

.icon-button {
  border: 1px solid var(--line);
  background: #f9fbfc;
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.messages {
  overflow: auto;
  padding: 18px 14px 96px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,.96)),
    repeating-linear-gradient(135deg, #f3f6f8 0 12px, #eef2f5 12px 24px);
}

.empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
}

.bubble {
  width: fit-content;
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.55;
  word-break: break-word;
  box-shadow: 0 4px 14px rgba(20, 30, 42, .07);
}

.bubble.inbound {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}

.bubble.outbound, .bubble.system {
  align-self: flex-start;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.bubble time {
  display: block;
  opacity: .65;
  font-size: 11px;
  margin-top: 4px;
}

.bubble img, .bubble video {
  max-width: 240px;
  border-radius: 6px;
  display: block;
}

.composer {
  position: sticky;
  bottom: 0;
  min-height: 70px;
  border-top: 1px solid var(--line);
  background: #fff;
  display: grid;
  grid-template-columns: 40px 1fr 72px;
  gap: 10px;
  padding: 12px;
  align-items: center;
}

.composer input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 12px;
  outline: none;
}

.composer button[type="submit"], .sheet button[value="default"] {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.complaint-fab {
  position: fixed;
  right: max(18px, calc((100vw - 520px) / 2 + 18px));
  bottom: 88px;
  border: 0;
  border-radius: 8px;
  background: var(--accent-2);
  color: #21170a;
  padding: 10px 14px;
  box-shadow: 0 10px 26px rgba(117, 79, 12, .18);
  cursor: pointer;
}

.sheet {
  width: min(92vw, 420px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(16, 28, 40, .3);
}

.sheet::backdrop { background: rgba(8, 16, 24, .38); }

.sheet form {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.sheet h2 {
  margin: 0 0 4px;
  font-size: 19px;
}

.sheet label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.sheet input, .sheet textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
}

.sheet menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.sheet button {
  min-width: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

@media (max-width: 560px) {
  .customer-app {
    width: 100%;
    box-shadow: none;
  }

  .bubble img, .bubble video {
    max-width: 70vw;
  }
}
