/* Chat UI + Rooms — WeChat-style layout (ref: liaotian/wxchat) */
:root {
  --chat-bg: var(--wx-chat-bg, #ebe6e1);
  --chat-bubble-me: var(--wx-bubble-me, #95ec69);
  --chat-bubble-other: var(--wx-bubble-them, #ffffff);
  --chat-border: rgba(0, 0, 0, 0.06);
}

body.chat-page {
  background: var(--chat-bg);
}

html {
  height: 100%;
}

body.chat-page:not(.rooms-page) {
  height: 100%;
  overflow: hidden;
  padding-bottom: 0;
}

.chat-header-inner {
  width: 100%;
}

.chat-cs-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  color: #152844;
  line-height: 36px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-inner .h5-logo {
  text-decoration: none;
}

.chat-header-inner .chat-topbar-clear {
  float: none;
  margin: 0 0 0 auto;
  flex-shrink: 0;
}

.rooms-shell {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 0 56px;
}

body.rooms-page {
  font-family: var(--font-sans);
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(7, 193, 96, 0.12), transparent 55%),
    radial-gradient(700px 360px at 100% 0%, rgba(16, 174, 255, 0.08), transparent 50%),
    #ededed;
  color: #111;
  padding-bottom: 0;
}

body.rooms-page .rooms-header {
  background: rgba(237, 237, 237, 0.92);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.rooms-page .rooms-header .title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #111;
  line-height: 36px;
}

body.rooms-page .chat-topbar-home {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  float: none;
  width: auto;
  padding: 0;
  overflow: visible;
}

body.rooms-page .chat-topbar-home > div:first-child {
  float: none;
  max-width: none;
  flex: 1;
  min-width: 0;
}

body.rooms-page .rooms-admin-link {
  float: none;
  margin-left: 0;
  height: 28px;
  line-height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  border: 0;
  color: #576b5c;
  background: rgba(7, 193, 96, 0.1);
  font-size: 12px;
}

body.rooms-page .h5-header-inner {
  align-items: center;
  max-width: 680px;
}

.rooms-hero {
  position: relative;
  overflow: hidden;
  min-height: 0;
  margin: 0 12px;
  padding: 22px 18px 16px;
  border-radius: 14px;
  background: #fff;
  color: #111;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
  animation: rooms-hero-in 0.45s ease both;
}

.rooms-hero::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #07c160 0%, #10aeff 100%);
}

.rooms-hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rooms-hero-mark {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: linear-gradient(145deg, #07c160, #0a9b4f);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 10px 22px rgba(7, 193, 96, 0.28);
  animation: rooms-mark-pop 0.55s 0.05s ease both;
}

.rooms-hero-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
  animation: rooms-copy-in 0.5s 0.08s ease both;
}

.rooms-hero h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: #111;
}

.rooms-hero p {
  margin: 6px 0 0;
  max-width: none;
  font-size: 13px;
  line-height: 1.5;
  color: #8a8a8a;
  letter-spacing: 0;
}

.rooms-hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.rooms-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 12px 12px;
  border: 0;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.rooms-action:active {
  transform: scale(0.98);
}

.rooms-action-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.rooms-action-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rooms-action-text strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.rooms-action-text small {
  font-size: 11px;
  color: inherit;
  opacity: 0.72;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rooms-action-primary {
  background: rgba(7, 193, 96, 0.1);
  color: #067843;
}

.rooms-action-primary .rooms-action-ico {
  background: linear-gradient(145deg, #07c160, #06ad56);
}

.rooms-action-primary:hover {
  background: rgba(7, 193, 96, 0.16);
}

.rooms-action-cs {
  background: rgba(16, 174, 255, 0.1);
  color: #0a6fad;
}

.rooms-action-cs .rooms-action-ico {
  background: linear-gradient(145deg, #10aeff, #0b7fd4);
}

.rooms-action-cs:hover {
  background: rgba(16, 174, 255, 0.16);
}

@keyframes rooms-hero-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rooms-copy-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rooms-mark-pop {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.rooms-panel {
  margin-top: 14px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.rooms-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: visible;
  margin: 0 16px 8px;
  padding: 2px 2px 0;
}

.rooms-panel-head h2 {
  float: none;
  margin: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  color: #666;
}

.rooms-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.06);
  color: #666;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.rooms-refresh-btn {
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: #576b5c;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.rooms-refresh-btn:active {
  background: #f3f3f3;
}

.rooms-list-wrap {
  margin: 0 12px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.rooms-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #fff;
  margin: 0;
}

.room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 14px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.045);
  background: #fff;
  transition: background 0.15s ease;
  animation: rooms-row-in 0.35s ease both;
}

.room-row:nth-child(1) { animation-delay: 0.02s; }
.room-row:nth-child(2) { animation-delay: 0.05s; }
.room-row:nth-child(3) { animation-delay: 0.08s; }
.room-row:nth-child(4) { animation-delay: 0.11s; }
.room-row:nth-child(5) { animation-delay: 0.14s; }

@keyframes rooms-row-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.room-row:last-child {
  border-bottom: none;
}

.room-row:hover {
  background: #f5f5f5;
}

.room-avatar {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

.room-avatar-room {
  background: linear-gradient(145deg, #07c160, #0a8f4a);
}

.room-avatar-cs {
  background: linear-gradient(145deg, #10aeff, #0b7fd4);
}

.room-row-main {
  min-width: 0;
  flex: 1;
}

.room-row-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}

.room-row-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #111;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  min-width: 0;
}

.room-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 12px;
  color: #999;
  min-width: 0;
}

.room-row-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.room-row-actions,
.room-row-admin {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.room-row-actions .chat-btn,
.room-row-actions .chat-btn-outline,
.room-row-admin .chat-btn-outline {
  height: 30px;
  line-height: 28px;
  padding: 0 11px;
  font-size: 12px;
  border-radius: 7px;
  float: none;
}

.room-row-actions .chat-btn.room-enter-btn {
  background: #07c160;
  border: 0;
  color: #fff;
}

.room-row-actions .chat-btn-outline,
.room-row-admin .chat-btn-outline {
  border: 0;
  background: #f2f2f2;
  color: #555;
}

.room-row-cs .room-enter-btn {
  background: #10aeff;
}

.room-badge {
  display: inline-block;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #bbb;
  font-size: 11px;
  font-weight: 400;
  flex: 0 0 auto;
}

.room-created {
  color: #bbb;
  flex-shrink: 0;
}

.room-slug {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #999;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.room-enter-btn {
  text-align: center;
  box-sizing: border-box;
}

.room-kind {
  display: inline-block;
  flex: 0 0 auto;
  margin: 0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  letter-spacing: 0;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
}

.room-kind-cs {
  color: #0a6fad;
  background: rgba(16, 174, 255, 0.14);
}

.room-kind-room {
  color: #067843;
  background: rgba(7, 193, 96, 0.14);
}

.rooms-empty {
  padding: 52px 20px 44px;
  text-align: center;
  color: #aaa;
  letter-spacing: 0;
  font-size: 14px;
  background: #fff;
}

.rooms-empty::before {
  content: '';
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(7, 193, 96, 0.18), rgba(7, 193, 96, 0.05));
  box-shadow: inset 0 0 0 1px rgba(7, 193, 96, 0.12);
}

.room-qr-box {
  max-width: 360px;
}

.room-qr-wrap {
  text-align: center;
  margin: 8px 0 14px;
}

.room-qr-image {
  width: 240px;
  height: 240px;
  margin: 0 auto;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #fff;
  padding: 10px;
  text-align: center;
}

.room-qr-image img,
.room-qr-image canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.room-share-link {
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  color: #475569;
  font-size: 12px;
  word-break: break-all;
}

.room-copy-state {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 12px;
}

.chat-toast {
  position: fixed;
  left: 50%;
  top: 70px;
  z-index: 30000;
  min-width: 160px;
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  text-align: center;
  font-size: 13px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.2);
  transform: translateX(-50%);
  -webkit-transform: translateX(-50%);
}

.layui-layer .chat-modal-box {
  width: auto;
  max-width: none;
  margin: 0;
}

@media (max-width: 768px) {
  .layui-layer {
    width: 92% !important;
    left: 50% !important;
    margin-left: 0 !important;
    transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
  }

  .layui-layer .chat-modal-box {
    width: 100%;
    box-sizing: border-box;
  }
}

.chat-shell {
  max-width: 1108px;
  margin: 0 auto;
  min-height: 0;
  position: relative;
  height: calc(100vh - var(--header-h));
  padding-bottom: 0;
}

.chat-topbar-room {
  width: auto;
}

.chat-topbar-room > div:first-child {
  max-width: calc(100% - 190px);
}

.chat-topbar-room:after {
  content: '';
  display: block;
  clear: both;
}

.chat-topbar-back {
  height: 32px;
  line-height: 30px;
  border-radius: 16px;
}

.chat-topbar-home {
  width: auto;
}

.chat-topbar-home > div:first-child {
  float: left;
  max-width: calc(100% - 130px);
}

.chat-topbar-home:after {
  content: '';
  display: block;
  clear: both;
}

.chat-topbar-home .title,
.chat-topbar-home .meta {
  display: block;
}

.chat-topbar {
  padding: 10px 12px;
  overflow: hidden;
}

.chat-topbar > div:first-child {
  float: left;
}

.chat-topbar > .chat-btn-outline,
.chat-topbar > .h5-btn-login,
.chat-topbar > button,
.chat-topbar > a {
  float: right;
}

.chat-topbar-clear {
  margin-right: 8px;
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.admin-login-panel {
  max-width: 460px;
  margin: 24px auto 0;
}

.admin-login-panel h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.chat-bubble.recalled,
.chat-row.me .chat-bubble.recalled {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #6b7280;
  font-style: italic;
}

.chat-row.me .chat-bubble.recalled .label,
.chat-row.me .chat-bubble.recalled .time {
  color: #6b7280;
}

.chat-recalled-text {
  font-size: 13px;
}

.chat-col {
  display: block;
  vertical-align: top;
  max-width: 100%;
  min-width: 0;
  position: relative;
  flex: 0 1 auto;
}

.chat-msg-actions {
  position: absolute;
  top: 50%;
  left: calc(100% + 6px);
  transform: translateY(-50%);
  margin: 0;
  line-height: 0;
  z-index: 2;
}

.chat-row.me .chat-msg-actions {
  left: calc(100% + 4px);
  right: auto;
  text-align: left;
}

.chat-recall {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(47, 127, 143, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #5b6b73;
  box-shadow: 0 1px 4px rgba(20, 40, 50, 0.08);
  cursor: pointer;
}

.chat-recall:hover,
.chat-recall:focus-visible {
  color: #c2410c;
  border-color: rgba(194, 65, 12, 0.35);
  background: #fff7ed;
  outline: none;
}

.chat-recall:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.chat-recall-icon {
  display: block;
  pointer-events: none;
}


.chat-topbar .title {
  font-size: 14px;
  color: #333;
  font-weight: 600;
}

.chat-topbar .meta {
  font-size: 12px;
  color: #909399;
}

.chat-messages {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 78px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 12px 18px;
  -webkit-overflow-scrolling: touch;
  background: var(--chat-bg);
}

.chat-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  overflow: visible;
  margin: 12px 0;
  max-width: 86%;
}

.chat-row:after {
  content: none;
}

.chat-row.me {
  margin-left: auto;
  flex-direction: row-reverse;
  text-align: left;
}

.chat-row.other {
  margin-right: auto;
}

.chat-col {
  min-width: 0;
  max-width: 100%;
}

.chat-avatar {
  --avatar-bg: #c4c4c4;
  --avatar-fg: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--avatar-bg, #c4c4c4);
  color: var(--avatar-fg, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  margin: 0;
}

.chat-row.me .chat-avatar {
  background: var(--wx-green, #07c160);
  color: #fff;
  margin: 0;
}

.chat-bubble {
  display: block;
  width: max-content;
  max-width: 100%;
  min-width: 52px;
  border-radius: 6px;
  padding: 10px 12px;
  border: 0;
  background: var(--chat-bubble-other);
  color: #111;
  position: relative;
  word-break: break-word;
  overflow-wrap: break-word;
  text-align: left;
  box-sizing: border-box;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
  font-size: 15px;
  line-height: 1.5;
}

.chat-row.me .chat-bubble {
  background: var(--chat-bubble-me);
  border-color: transparent;
  color: #111;
}

.chat-bubble .label {
  display: block;
  font-size: 11px;
  color: #8a8a8a;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  word-break: keep-all;
  line-height: 1.3;
}

.chat-row.me .chat-bubble .label {
  display: none;
}

.chat-bubble .time {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.2;
  color: #999;
  white-space: nowrap;
  text-align: right;
  opacity: 0.9;
  letter-spacing: 0;
}

.chat-row.me .chat-bubble .time {
  color: rgba(0, 0, 0, 0.45);
}

.chat-image-link {
  display: block;
  width: 400px;
  max-width: 100%;
  cursor: zoom-in;
}

.chat-image {
  display: block;
  width: 400px;
  max-width: 100%;
  height: 350px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
}

.chat-image-caption {
  margin-top: 6px;
}

.chat-file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
}

.chat-file-icon {
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
}

.chat-file-icon.pdf {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-color: #fca5a5;
  color: #b91c1c;
}

.chat-file-icon.zip {
  background: linear-gradient(135deg, #ffedd5, #fed7aa);
  border-color: #fdba74;
  color: #c2410c;
}

.chat-file-icon.sheet {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  border-color: #86efac;
  color: #15803d;
}

.chat-file-icon.doc {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-color: #93c5fd;
  color: #1d4ed8;
}

.chat-file-icon.ppt {
  background: linear-gradient(135deg, #ffedd5, #fdba74);
  border-color: #fb923c;
  color: #c2410c;
}

.chat-file-icon.audio {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border-color: #c4b5fd;
  color: #6d28d9;
}

.chat-file-icon.video {
  background: linear-gradient(135deg, #fae8ff, #f5d0fe);
  border-color: #f0abfc;
  color: #a21caf;
}

.chat-file-icon.image {
  background: linear-gradient(135deg, #cffafe, #a5f3fc);
  border-color: #67e8f9;
  color: #0f766e;
}

.chat-file-icon.app {
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  border-color: #a5b4fc;
  color: #4338ca;
}

.chat-video {
  display: block;
  width: 100%;
  max-width: 280px;
  max-height: 245px;
  border-radius: 10px;
  margin: 4px 0 8px;
  background: #000;
}

.chat-image-preview-wrap {
  position: relative;
  padding: 10px 54px;
  background: #000;
}

.chat-image-preview-nav {
  position: absolute;
  top: 50%;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 24px;
  line-height: 36px;
  text-align: center;
}

.chat-image-preview-nav.prev {
  left: 10px;
}

.chat-image-preview-nav.next {
  right: 10px;
}

.chat-file-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.chat-file-name {
  font-size: 14px;
  color: inherit;
  word-break: break-all;
}

.chat-file-size {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

.chat-image-preview-wrap {
  padding: 10px;
  background: #000;
}

.chat-image-preview {
  display: block;
  max-width: min(92vw, 1200px);
  max-height: 86vh;
}

.chat-composer {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 50;
  width: 100%;
  max-width: 1108px;
  margin-left: -554px;
  background: #fff;
  border-top: 1px solid var(--chat-border);
  padding: 10px 12px;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}

.chat-compose-row {
  overflow: hidden;
}

.chat-file-btn,
.chat-input,
.chat-btn {
  float: left;
}

.chat-file-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #e4e7ed;
  background: #fff;
  color: #606266;
  text-align: center;
  padding: 0;
}

.chat-file-btn svg {
  margin-top: 8px;
}

.chat-input {
  width: 68%;
  height: 40px;
  margin: 0 10px;
  padding: 0 12px;
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  background: #f5f7fa;
  outline: none;
}

.chat-input:focus {
  background: #fff;
  border-color: var(--color-primary);
}

.chat-btn {
  height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 500;
}

.chat-btn:disabled {
  opacity: 0.6;
}

.chat-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

label.chat-file-btn {
  cursor: pointer;
  box-sizing: border-box;
}

.chat-modal {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 20000;
  text-align: center;
  padding: 16px;
}

.chat-modal[hidden] {
  display: none !important;
}

.chat-modal:before {
  content: '';
  display: inline-block;
  height: 100%;
  vertical-align: middle;
}

.chat-modal-backdrop {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  border: none;
  margin: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.45);
}

.chat-modal-box {
  position: relative;
  z-index: 1;
  display: inline-block;
  vertical-align: middle;
  width: 100%;
  max-width: 420px;
  text-align: left;
  background: #fff;
  border-radius: 10px;
  padding: 18px 18px 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}

#chat-register-modal .chat-modal-box {
  position: fixed;
  left: 50%;
  top: 50%;
  display: block;
  width: 92%;
  max-width: 420px;
  margin: 0;
  transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
}

.chat-modal-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  color: #0f1111;
}

.chat-modal-desc {
  margin: 0 0 14px;
  font-size: 13px;
  color: #606266;
  line-height: 1.6;
}

.chat-form {
  overflow: hidden;
}

.chat-form input {
  display: block;
  width: 100%;
  height: 40px;
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  padding: 0 12px;
  margin-bottom: 10px;
  outline: none;
  background: #f8fafc;
}

.chat-form input:focus {
  border-color: var(--color-primary);
  background: #fff;
}

.chat-form .err {
  font-size: 12px;
  color: #f56c6c;
  min-height: 16px;
}

.chat-form .actions {
  overflow: hidden;
  margin-top: 6px;
}

.chat-form .actions .chat-btn-outline,
.chat-form .actions .chat-btn-primary {
  float: right;
  margin-left: 10px;
}

.chat-btn-outline {
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #333;
}

.chat-btn-primary {
  height: 36px;
  padding: 0 18px;
  border-radius: 18px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-weight: 500;
}

@media (max-width: 1120px) {
  .chat-composer {
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    margin-left: 0;
  }
}

@media (max-width: 900px) {
  .rooms-hero {
    min-height: 0;
    padding: 20px 16px 14px;
  }

  .rooms-hero h1 {
    font-size: 22px;
    letter-spacing: 0.03em;
  }
}

@media (max-width: 768px) {
  .h5-header {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
  }

  .h5-header-inner {
    padding-left: 10px;
    padding-right: 10px;
  }

  body.chat-page {
    padding-bottom: 0;
  }

  .chat-shell {
    width: 100%;
    height: 100vh;
    min-height: 0;
    margin: 0;
    padding: 0;
  }

  .chat-topbar {
    padding: 8px 0;
  }

  .chat-topbar-room .title,
  .chat-topbar-room .meta {
    max-width: 170px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .chat-topbar-back {
    margin-top: 2px;
  }

  .chat-messages {
    top: var(--header-h);
    bottom: 78px;
    min-height: 0;
    padding: 12px 10px 18px;
    box-sizing: border-box;
  }

  .chat-row {
    margin: 8px 0;
  }

  .chat-avatar {
    width: 32px;
    height: 32px;
    line-height: 32px;
    margin-right: 8px;
  }

  .chat-row.me .chat-avatar {
    margin-left: 30px;
  }

  .chat-col {
    max-width: min(78%, calc(100% - 48px));
  }

  .chat-bubble {
    width: max-content;
    max-width: 100%;
    font-size: 15px;
    padding: 8px 12px;
    border-radius: 14px;
  }

  .chat-bubble .label {
    font-size: 10px;
    margin-bottom: 2px;
    max-width: 12em;
  }

  .chat-bubble .time {
    font-size: 10px;
    margin-top: 2px;
  }

  .chat-image-link,
  .chat-image,
  .chat-video {
    width: 100%;
    max-width: 280px;
    height: 245px;
  }

  .chat-file-icon {
    flex-basis: 64px;
    width: 64px;
    height: 64px;
    font-size: 15px;
  }

  .chat-image-preview-wrap {
    padding: 10px 42px;
  }

  .chat-image-preview-nav {
    width: 30px;
    height: 30px;
    margin-top: -15px;
    font-size: 20px;
    line-height: 30px;
  }

  .chat-file-name {
    font-size: 13px;
  }

  .chat-composer {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    margin-left: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .chat-compose-row {
    position: relative;
  }

  .chat-file-btn {
    width: 38px;
    height: 38px;
  }

  .chat-file-btn svg {
    margin-top: 7px;
  }

  .chat-input {
    width: calc(100% - 114px);
    margin: 0 8px;
    height: 38px;
  }

  .chat-btn {
    width: 60px;
    height: 38px;
    padding: 0;
  }
}

@media (max-width: 768px) {
  .rooms-shell {
    padding: 58px 0 40px;
  }

  .rooms-hero {
    min-height: 0;
    padding: 18px 14px 12px;
    border-radius: 12px;
    margin: 0 10px 8px;
  }

  .rooms-hero-mark {
    width: 50px;
    height: 50px;
    font-size: 24px;
    border-radius: 12px;
  }

  .rooms-hero-actions {
    grid-template-columns: 1fr;
    margin-top: 14px;
    gap: 8px;
  }

  .rooms-action {
    padding: 11px 12px;
  }

  .rooms-hero h1 {
    font-size: 22px;
    letter-spacing: 0.03em;
  }

  .rooms-hero p {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.5;
  }

  .rooms-panel {
    margin-top: 12px;
    padding: 0;
    border-radius: 0;
  }

  .rooms-panel-head {
    margin: 0 14px 6px;
  }

  .rooms-panel-head h2 {
    margin-top: 0;
    font-size: 12px;
  }

  .rooms-list-wrap {
    margin: 0 10px;
    border-radius: 12px;
  }

  .room-row {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }

  .room-row-side {
    width: 100%;
    padding-left: 58px;
  }

  .room-row-side {
    align-items: stretch;
  }

  .room-row-actions,
  .room-row-admin {
    justify-content: stretch;
  }

  .room-row-actions .chat-btn,
  .room-row-actions .chat-btn-outline,
  .room-row-admin .chat-btn-outline {
    flex: 1;
    text-align: center;
  }

  .room-row-name {
    white-space: normal;
  }

  .room-row-meta {
    flex-wrap: wrap;
    gap: 8px;
  }

  #room-create-modal,
  #room-qr-modal {
    padding: 0;
  }

  #room-create-modal:before,
  #room-qr-modal:before {
    display: none;
  }

  #room-create-modal .chat-modal-box,
  #room-qr-modal .chat-modal-box {
    position: fixed;
    left: 50%;
    top: 48%;
    display: block;
    width: 90%;
    max-width: none;
    max-height: 78vh;
    overflow: auto;
    margin: 0;
    padding: 16px 14px 14px;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
  }

  #room-create-modal .chat-modal-box {
    top: 43%;
    max-height: 68vh;
    padding-bottom: 18px;
  }

  #room-create-modal .chat-form {
    overflow: visible;
  }

  #room-create-modal .chat-form input {
    height: 42px;
    font-size: 16px;
    margin-bottom: 12px;
  }

  #room-create-modal .chat-modal-desc {
    margin-bottom: 12px;
  }

  #room-create-modal .chat-form .err {
    min-height: 18px;
    margin-bottom: 4px;
  }

  #room-create-modal .chat-form .actions,
  #room-qr-modal .actions {
    overflow: visible;
    margin-top: 12px;
  }

  #room-create-modal .chat-form .actions .chat-btn-outline,
  #room-create-modal .chat-form .actions .chat-btn-primary,
  #room-qr-modal .actions .chat-btn-outline,
  #room-qr-modal .actions .chat-btn-primary {
    float: none;
    display: block;
    width: 100%;
    height: 40px;
    line-height: 40px;
    text-align: center;
    margin: 0 0 10px;
    border-radius: 12px;
  }

  #room-create-modal .chat-form .actions .chat-btn-primary,
  #room-qr-modal .actions .chat-btn-outline:last-child {
    margin-bottom: 0;
  }

  .room-qr-box {
    max-width: none;
  }

  .room-qr-image {
    width: 210px;
    height: 210px;
  }

  .chat-topbar-home .title {
    font-size: 18px;
    line-height: 1.2;
    letter-spacing: 0.06em;
  }
}

@media (max-width: 640px) {
  #chat-register-modal {
    padding: 0;
  }

  #chat-register-modal:before {
    display: none;
  }

  #chat-register-modal .chat-modal-box {
    width: 90%;
    max-width: none;
    left: 50%;
    top: 46%;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
  }

  .chat-topbar-clear,
  .chat-topbar-back,
  #admin-entry {
    height: 30px;
    line-height: 28px;
    padding: 0 10px;
    font-size: 12px;
  }

  .chat-topbar-room > div:first-child,
  .chat-topbar-home > div:first-child {
    max-width: calc(100% - 150px);
  }
}


/* ===== Chat room page: clean ink UI ===== */
body.chat-room-page {
  background:
    radial-gradient(ellipse 70% 48% at 88% -6%, rgba(47, 127, 143, 0.13), transparent 56%),
    radial-gradient(ellipse 55% 40% at 6% 100%, rgba(90, 110, 100, 0.08), transparent 52%),
    linear-gradient(180deg, #e4ecec 0%, #eef2f1 48%, #e6ebe9 100%);
}

body.chat-room-page .chat-room-header {
  background: rgba(250, 252, 252, 0.9);
  border-bottom: 1px solid rgba(160, 180, 178, 0.38);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.chat-room-page .h5-header.chat-room-header,
body.chat-room-page .chat-room-header {
  background: rgba(245, 245, 245, 0.96);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body.chat-room-page .chat-cs-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  color: #111;
}

body.chat-room-page .chat-topbar-clear {
  height: 30px;
  line-height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
  border-color: rgba(0, 0, 0, 0.12);
  color: #333;
  background: #fff;
}

body.chat-room-page .chat-shell {
  max-width: 860px;
  background: var(--chat-bg);
}

body.chat-room-page .chat-messages {
  bottom: 72px;
  padding: 16px 14px 20px;
  background: var(--chat-bg);
}

body.chat-room-page .chat-row {
  margin: 12px 0;
  max-width: 78%;
}

body.chat-room-page .chat-avatar {
  width: 36px;
  height: 36px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  margin: 0;
}

body.chat-room-page .chat-row.me .chat-avatar {
  margin: 0;
  background: var(--wx-green, #07c160);
  color: #fff;
}

body.chat-room-page .chat-col {
  max-width: 100%;
  min-width: 0;
}

body.chat-room-page .chat-bubble {
  width: max-content;
  max-width: 100%;
  border-radius: 6px;
  padding: 10px 12px;
  border: 0;
  background: #fff;
  color: #111;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
  overflow-wrap: break-word;
  font-size: 15px;
}

body.chat-room-page .chat-row.me .chat-bubble {
  background: var(--wx-bubble-me, #95ec69);
  border-color: transparent;
  color: #111;
}

body.chat-room-page .chat-bubble .label {
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0;
  color: #8a8a8a;
}

body.chat-room-page .chat-row.me .chat-bubble .label {
  display: none;
}

body.chat-room-page .chat-bubble .time {
  margin-top: 4px;
  font-size: 10px;
  color: #999;
}

body.chat-room-page .chat-row.me .chat-bubble .time {
  color: rgba(0, 0, 0, 0.45);
}

body.chat-room-page .chat-image,
body.chat-room-page .chat-image-link {
  width: 100%;
  max-width: 220px;
  height: auto;
  max-height: 220px;
  border-radius: 4px;
}

body.chat-room-page .chat-composer {
  left: 50%;
  max-width: 860px;
  margin-left: -430px;
  background: var(--wx-composer-bg, #f5f5f5);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  box-shadow: none;
}

body.chat-room-page .chat-compose-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  overflow: visible;
}

body.chat-room-page .chat-file-btn,
body.chat-room-page .chat-input,
body.chat-room-page .chat-btn {
  float: none;
}

body.chat-room-page .chat-file-btn {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 0;
  background: #fff;
  color: #444;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.chat-room-page .chat-file-btn svg {
  margin-top: 0;
}

body.chat-room-page .chat-input {
  flex: 1;
  width: auto;
  min-width: 0;
  height: 40px;
  margin: 0;
  padding: 0 12px;
  border-radius: 8px;
  border: 0;
  background: #fff;
  font-size: 15px;
}

body.chat-room-page .chat-input:focus {
  background: #fff;
  border-color: transparent;
  outline: none;
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.18);
}

body.chat-room-page .chat-btn {
  flex: 0 0 auto;
  min-width: 64px;
  height: 36px;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--wx-green, #07c160);
  font-weight: 600;
  border: 0;
}

body.chat-room-page .chat-btn:active {
  background: var(--wx-green-deep, #06ad56);
}

body.chat-room-page .chat-recall {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(47, 127, 143, 0.2);
  background: rgba(255, 255, 255, 0.95);
  color: #5b6b73;
  box-shadow: 0 1px 4px rgba(20, 40, 50, 0.08);
}

body.chat-room-page .chat-modal-box {
  border-radius: 18px;
  padding: 22px 20px 18px;
  border: 1px solid rgba(178, 200, 220, 0.45);
  box-shadow: 0 24px 48px rgba(16, 42, 72, 0.16);
}

body.chat-room-page .chat-modal-title {
  font-size: 20px;
  color: #13293f;
  letter-spacing: 0.04em;
}

body.chat-room-page .chat-modal-desc {
  color: #6d859c;
}

@media (max-width: 1120px) {
  body.chat-room-page .chat-composer {
    left: 0;
    right: 0;
    margin-left: 0;
    max-width: none;
  }
}

@media (max-width: 768px) {
  body.chat-room-page .chat-messages {
    top: var(--header-h);
    bottom: 72px;
    padding: 12px 10px 16px;
  }

  body.chat-room-page .chat-row {
    max-width: 86%;
  }

  body.chat-room-page .chat-col {
    max-width: 100%;
  }

  body.chat-room-page .chat-composer {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  body.chat-room-page .chat-btn {
    min-width: 58px;
    padding: 0 12px;
  }
}


body.chat-room-page .chat-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 48px;
  background: rgba(8, 18, 32, 0.88);
}

body.chat-room-page .chat-image-lightbox[hidden] {
  display: none !important;
}

body.chat-room-page .chat-image-lightbox .chat-image-preview {
  max-width: min(92vw, 1100px);
  max-height: 86vh;
  width: auto;
  height: auto;
  border-radius: 8px;
}

body.chat-room-page .chat-image-lightbox-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 26px;
  line-height: 40px;
}

body.chat-room-page .chat-image-lightbox .chat-image-preview-nav {
  position: absolute;
  top: 50%;
  margin-top: -20px;
}

body.chat-room-page .chat-image-lightbox .chat-image-preview-nav.prev {
  left: 12px;
}

body.chat-room-page .chat-image-lightbox .chat-image-preview-nav.next {
  right: 12px;
}



/* 客服访客开场公告（微信系统提示风格） */
.chat-announce {
  margin: 4px 24px 16px;
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  border: 0;
  color: #666;
  box-shadow: none;
  text-align: left;
}
.chat-announce-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: #07c160;
  margin-bottom: 4px;
}
.chat-announce-body {
  font-size: 13px;
  line-height: 1.55;
  white-space: normal;
  word-break: break-word;
  color: #555;
}
.chat-announce-body p {
  margin: 0 0 0.4em;
}
.chat-announce-body p:last-child {
  margin-bottom: 0;
}
.chat-announce-body ul,
.chat-announce-body ol {
  margin: 0.25em 0 0.25em 1.2em;
  padding: 0;
}
.chat-announce-body a {
  color: #576b95;
  text-decoration: none;
}

#room-announce {
  width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  font: inherit;
  resize: vertical;
  min-height: 72px;
  background: #f5f7fa;
}
#room-announce[hidden] { display: none !important; }
