:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-hover: #f4f7fb;
  --border: #dce3ed;
  --text: #1a2332;
  --text-muted: #64748b;
  --primary: #1e3a5f;
  --primary-hover: #152a47;
  --admin: #0d9488;
  --user: #2563eb;
  --danger: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body:not(.embed-mode) {
  background: #dde4ed;
  height: 100%;
  overflow: hidden;
}

html {
  height: 100%;
}

#chat-screen.screen {
  min-height: 0;
  height: 100dvh;
  max-height: 100dvh;
  align-items: stretch;
  justify-content: flex-start;
}

.hidden {
  display: none !important;
}

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.logo {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-card h1 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 1rem;
}

.login-status {
  text-align: center;
  font-size: 0.85rem;
  min-height: 1.2rem;
  margin-top: 0.75rem;
  color: var(--text-muted);
}

.login-status.error {
  color: var(--danger);
}

.login-status.connecting {
  color: var(--primary);
}

.text-btn {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.25rem;
}

.text-btn:hover {
  color: var(--text);
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

input[type="text"],
input[type="password"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

input:focus {
  border-color: var(--primary);
}

button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover:not(:disabled) {
  background: var(--primary-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Chat screen */
#chat-screen {
  flex-direction: column;
  align-items: stretch;
  max-width: 860px;
  margin: 0 auto;
  padding: 0;
  min-height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow);
}

#chat-screen.chat-app {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1.25rem;
  gap: 0.75rem;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--primary) 0%, #2d4a6f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(30, 58, 95, 0.2);
}

.brand-mark::after {
  content: "";
  width: 14px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 5px 5px 5px 2px;
}

.notify-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1.4;
}

.notify-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: #c5d0dc;
}

.notify-btn.active {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(30, 58, 95, 0.06);
}

.header-actions,
.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-small {
  font-size: 1.75rem;
}

.chat-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status.connected {
  color: var(--admin);
}

.status.disconnected {
  color: var(--danger);
}

.badge {
  background: var(--user);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.name-badge {
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}

.name-badge:hover {
  opacity: 0.85;
}

.name-edit-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-hover);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: right;
  transition: background 0.15s, border-color 0.15s;
  max-width: 140px;
}

.name-edit-btn:hover {
  background: #e8edf4;
  border-color: #c5d0dc;
}

.name-edit-btn:active {
  background: #e2e8f0;
}

.name-edit-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.name-edit-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.2;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name-edit-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.ios-install-tip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a5f;
  font-size: 0.85rem;
  line-height: 1.45;
  flex-shrink: 0;
}

.ios-install-tip-close {
  flex-shrink: 0;
  border: none;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  background: var(--user);
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}

.ios-install-tip-close:hover {
  background: #1d4ed8;
}

.admin-badge {
  background: var(--admin);
}

.messages {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  padding: 1.25rem;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.message {
  max-width: 72%;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font-size: 0.9375rem;
  line-height: 1.55;
  word-break: break-word;
}

.message .meta {
  font-size: 0.7rem;
  opacity: 0.75;
  margin-bottom: 0.3rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.read-receipt {
  font-size: 0.65rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  line-height: 1.3;
  opacity: 1;
}

.read-receipt.unread {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
}

.read-receipt.read {
  color: var(--admin);
  background: rgba(16, 185, 129, 0.15);
}

.message.sent .meta {
  justify-content: flex-end;
  opacity: 1;
  color: rgba(255, 255, 255, 0.9);
}

.message.sent .read-receipt.unread {
  color: #fef08a;
  background: rgba(255, 255, 255, 0.22);
}

.message.sent .read-receipt.read {
  color: #fff;
  background: rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

.list-unread {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  flex-shrink: 0;
}

#user-list li .user-name,
#admin-list li .user-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message.sent {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 2px;
  box-shadow: 0 1px 3px rgba(30, 58, 95, 0.18);
}

.message.received {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 2px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.message.system {
  align-self: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.25rem;
  max-width: 100%;
}

.chat-input {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.875rem 1.25rem;
}

.chat-input form {
  flex-direction: column;
}

.input-area {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-hover);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-area:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.08);
  background: var(--surface);
}

.input-area.drag-over {
  border-color: var(--primary);
  background: rgba(30, 58, 95, 0.04);
}

.input-area textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  outline: none;
  min-height: 24px;
  max-height: 120px;
  padding: 0.35rem 0;
}

.input-area textarea:disabled {
  opacity: 0.5;
}

.attach-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.4rem 0.7rem;
  font-size: 0.8125rem;
  font-weight: 500;
  flex-shrink: 0;
  line-height: 1.4;
  min-height: 36px;
}

.attach-btn:hover:not(:disabled) {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}

.send-btn,
.input-area button[type="submit"] {
  padding: 0.4rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  min-height: 36px;
  flex-shrink: 0;
  border-radius: 5px;
}

.message-body {
  line-height: 1.5;
  word-break: break-word;
}

.message-image {
  display: block;
  max-width: 240px;
  max-height: 240px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 0.25rem;
}

.message.sent .message-image {
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.message.received .message-image {
  border: 1px solid var(--border);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.image-lightbox.hidden {
  display: none;
}

body.lightbox-open {
  overflow: hidden;
}

.lightbox-image {
  max-width: min(92vw, 1200px);
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.file-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.file-link:hover {
  opacity: 0.85;
}

.message.sent .file-link {
  color: #bfdbfe;
}

.message.received .file-link {
  color: var(--user);
}

/* Admin layout */
.admin-body {
  background: #e8ecf1;
  margin: 0;
  height: 100vh;
  overflow: hidden;
}

.admin-body #admin-screen {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  max-width: none;
  margin: 0;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.admin-shell {
  display: flex;
  flex: 1;
  min-height: 100vh;
  width: 100%;
}

.admin-nav-rail {
  width: 56px;
  background: #2b3137;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0;
  flex-shrink: 0;
}

.nav-brand {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.nav-item {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.35rem;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

.nav-item.active {
  background: #3b82f6;
  color: #fff;
}

.nav-spacer {
  flex: 1;
}

.nav-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.25rem 0;
  width: 100%;
}

.nav-admin-badge {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.1);
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.nav-status {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
  line-height: 1.2;
}

.nav-status.connected {
  color: #4ade80;
}

.nav-status.disconnected {
  color: #f87171;
}

.nav-status.connecting {
  color: #fbbf24;
}

.admin-list-panel {
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.list-panel-header {
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.list-panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.admin-list-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.list-section {
  padding: 0.75rem 0.75rem 0;
}

.list-section + .list-section {
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
}

.list-section h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.list-panel-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.list-panel-actions .notify-btn {
  flex: 1;
  font-size: 0.78rem;
  padding: 0.4rem 0.5rem;
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #f0f2f5;
}

.admin-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.settings-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}

.settings-header h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.settings-tabs {
  display: flex;
  gap: 0.25rem;
}

.settings-tab {
  border: none;
  background: transparent;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.settings-tab:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.settings-tab.active {
  background: var(--primary);
  color: #fff;
}

.settings-panel {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.settings-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.settings-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.settings-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.55;
  margin-top: 0.75rem;
}

.settings-hint code {
  background: #f4f7fb;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.settings-download-btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
}

.settings-download-btn:hover {
  background: var(--primary-hover);
}

.settings-list {
  margin-top: 1rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.settings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.settings-table th,
.settings-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.settings-table th {
  background: #f8fafc;
  font-weight: 600;
}

.settings-table code {
  background: #f4f7fb;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.8rem;
}

.embed-code-tall {
  max-height: 200px;
}

.admin-header {
  display: none;
}

.admin-header h1 {
  font-size: 1.25rem;
}

.admin-team {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.user-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.user-app {
  display: flex;
  flex-direction: column;
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
}

.user-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1rem;
  flex: 1;
  min-height: calc(100vh - 120px);
}

.chat-panel .messages {
  flex: 1;
  margin-bottom: 0;
  border: none;
  border-radius: 0;
  min-height: 320px;
  max-height: calc(100vh - 280px);
}

.chat-panel .chat-input {
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
}

.chat-panel .chat-input .input-area {
  margin-bottom: 0;
}

.admin-layout {
  display: none;
}

#chat-view .placeholder,
#chat-view #chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#chat-view #chat-area.hidden {
  display: none;
}

#chat-view .placeholder {
  background: var(--surface);
  margin: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

#chat-view #chat-area {
  margin: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

#contact-list {
  list-style: none;
}

#contact-list li {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#contact-list li:hover {
  background: var(--surface-hover);
}

#contact-list li.active {
  background: var(--primary);
  color: white;
}

#contact-list li .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--admin);
  flex-shrink: 0;
}

#contact-list li .dot.offline {
  background: var(--text-muted);
}

#contact-list li .badge {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
}

#contact-list li.active .badge {
  color: rgba(255, 255, 255, 0.85);
}

.user-panel {
  display: none;
}

.user-panel h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.count {
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}

#user-list {
  list-style: none;
}

#user-list li,
#admin-list li {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#user-list li:hover,
#admin-list li:hover {
  background: var(--surface-hover);
}

#user-list li.active,
#admin-list li.active {
  background: var(--primary);
  color: white;
}

#user-list li .dot,
#admin-list li .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--admin);
  flex-shrink: 0;
}

#user-list li .dot.offline,
#admin-list li .dot.offline {
  background: var(--text-muted);
}

.panel-divider {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.embed-code-panel h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.embed-hint {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
  margin-bottom: 0.5rem;
}

.embed-hint-sub {
  margin-top: 0.75rem;
}

.embed-code-wrap {
  position: relative;
}

.embed-code {
  background: #f4f7fb;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.72rem;
  line-height: 1.5;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  max-height: 140px;
  margin: 0;
}

.copy-embed-btn {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 5px;
  background: var(--surface-hover);
  color: var(--primary);
  border: 1px solid var(--border);
}

.copy-embed-btn:hover {
  background: #e8edf4;
  border-color: #c5d0dc;
}

.embed-demo-link {
  display: block;
  margin-top: 0.65rem;
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
}

.embed-demo-link:hover {
  text-decoration: underline;
}

#admin-list {
  list-style: none;
}

#admin-list li .dot {
  background: var(--admin);
}

.empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem 0;
}

.chat-panel {
  display: none;
}

.placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.chat-target {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--admin);
}

.online-dot.offline {
  background: var(--text-muted);
}

.admin-messages {
  border: none;
  border-radius: 0;
  margin-bottom: 0;
  flex: 1;
}

#chat-area {
  display: flex;
  flex-direction: column;
  flex: 1;
}

#chat-area .chat-input {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  #chat-screen {
    max-width: 100%;
    box-shadow: none;
  }

  .admin-list-panel {
    width: 220px;
  }

  .admin-layout,
  .user-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .user-panel {
    max-height: 180px;
  }

  .embed-code {
    max-height: 100px;
    font-size: 0.68rem;
  }

  .message {
    max-width: 85%;
  }
}
