:root {
  --zalo-blue: #0068ff;
  --zalo-blue-dark: #0054cc;
  --zalo-blue-soft: #e5efff;
  --zalo-blue-hover: #f0f6ff;
  --nav-rail-bg: #0068ff;
  --bg-app: #ffffff;
  --bg-canvas: #eef0f3;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-input: #f1f3f5;
  --bg-hover: #f5f7fa;
  --bg-subtle: #f8fafc;
  --bubble-theirs: #ffffff;
  --bubble-mine: #e5efff;
  --bubble-mine-border: #d4e4ff;
  --auth-bg: linear-gradient(135deg, #dbeafe 0%, #eff6ff 55%, #ffffff 100%);
  --border: #e5e7eb;
  --border-subtle: #f3f4f6;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --online: #22c55e;
  --danger: #ef4444;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.12);
  --radius: 10px;
}

[data-theme="dark"] {
  --zalo-blue: #2580ff;
  --zalo-blue-dark: #1a6de0;
  --zalo-blue-soft: #173463;
  --zalo-blue-hover: #1c2c47;
  --nav-rail-bg: #0f2952;
  --bg-app: #111827;
  --bg-canvas: #0d131d;
  --bg-sidebar: #161d29;
  --bg-surface: #1b2433;
  --bg-input: #232f42;
  --bg-hover: #212d40;
  --bg-subtle: #182130;
  --bubble-theirs: #1e293b;
  --bubble-mine: #173463;
  --bubble-mine-border: #254b8a;
  --auth-bg: linear-gradient(135deg, #0b1220 0%, #111b2e 55%, #162238 100%);
  --border: #283447;
  --border-subtle: #202b3c;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-primary);
  background: var(--bg-canvas);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ===== BUTTONS & INPUTS ===== */
.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--zalo-blue);
  color: #fff;
}
.btn-primary:hover { background: var(--zalo-blue-dark); }
.btn-outline {
  background: var(--bg-surface);
  color: var(--zalo-blue);
  border: 1px solid var(--zalo-blue);
}
.btn-outline:hover { background: var(--zalo-blue-soft); }
.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.24); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-full { width: 100%; }

.icon-btn {
  background: transparent;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.theme-float-btn {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 19px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, background 0.15s;
}
.theme-float-btn:hover {
  transform: scale(1.06);
  background: var(--bg-hover);
}

/* ===== AUTH SCREEN ===== */
.auth-backdrop {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--auth-bg);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 410px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
}

.auth-brand {
  text-align: center;
  margin-bottom: 22px;
}
.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--zalo-blue);
  color: #fff;
  font-size: 30px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  box-shadow: 0 6px 16px rgba(0, 104, 255, 0.3);
}
.auth-brand h1 {
  font-size: 24px;
  color: var(--zalo-blue);
  font-weight: 800;
}
.auth-brand p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-input);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tab {
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 8px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}
.auth-tab.active {
  background: var(--bg-surface);
  color: var(--zalo-blue);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.field input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--zalo-blue);
  box-shadow: 0 0 0 3px rgba(0, 104, 255, 0.14);
}

.form-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.form-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}
[data-theme="dark"] .form-success {
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
}

/* ===== MAIN APP SHELL ===== */
.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  background: var(--bg-app);
}

/* 1. Left Blue Rail */
.nav-rail {
  width: 64px;
  background: var(--nav-rail-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  flex-shrink: 0;
}
.nav-top, .nav-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.rail-avatar-btn {
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: transparent;
  padding: 0;
  cursor: pointer;
  margin-bottom: 10px;
}
.rail-btn {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.rail-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.rail-btn.active {
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
}
.rail-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ws-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #facc15;
  border: 2px solid rgba(255, 255, 255, 0.6);
}
.ws-dot.connected { background: var(--online); }
.ws-dot.disconnected { background: var(--danger); }

/* Avatars */
.avatar {
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  position: relative;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 44px; height: 44px; font-size: 15px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }

.avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #9ca3af;
}
.status-dot.online { background: var(--online); }

/* 2. Middle Sidebar */
.sidebar {
  width: 325px;
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header {
  height: 64px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border-radius: 8px;
  padding: 0 10px;
  height: 36px;
}
.search-icon { color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  border: none;
  background: transparent;
  color: var(--text-primary);
  width: 100%;
  outline: none;
  font-size: 13.5px;
}

.sidebar-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.filter-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 14px 6px;
  border-bottom: 1px solid var(--border-subtle);
}
.filter-tab {
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}
.filter-tab.active {
  background: var(--zalo-blue-soft);
  color: var(--zalo-blue);
}

.list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active { background: var(--zalo-blue-soft); }

.conv-meta {
  flex: 1;
  min-width: 0;
}
.conv-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.conv-top-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.conv-edit-nick-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s;
}
.conv-item:hover .conv-edit-nick-btn,
.conv-edit-nick-btn:focus-visible {
  opacity: 0.85;
}
.conv-edit-nick-btn:hover {
  opacity: 1;
  background: var(--bg-subtle, rgba(128, 128, 128, 0.16));
}
.conv-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-time {
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.conv-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}
.conv-preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item.unread .conv-name,
.conv-item.unread .conv-preview {
  font-weight: 700;
  color: var(--text-primary);
}
.unread-pill {
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
}
.contact-card:hover { background: var(--bg-hover); }
.contact-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.contact-sub {
  font-size: 12px;
  color: var(--text-secondary);
}
.contact-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.empty-list {
  text-align: center;
  color: var(--text-muted);
  padding: 36px 16px;
  font-size: 13px;
}

/* 3. Chat Main */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  min-width: 0;
}

.chat-welcome {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.welcome-card {
  max-width: 440px;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 36px 28px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.welcome-icon { font-size: 48px; margin-bottom: 12px; }
.welcome-card h2 { font-size: 22px; margin-bottom: 8px; }
.welcome-card h2 span { color: var(--zalo-blue); }
.welcome-card p { color: var(--text-secondary); margin-bottom: 20px; }
.welcome-actions { display: flex; gap: 10px; justify-content: center; }

.chat-active {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  position: relative;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 104, 255, 0.14);
  backdrop-filter: blur(4px);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}
.drop-overlay-box {
  background: var(--bg-surface);
  border: 2.5px dashed var(--zalo-blue);
  border-radius: 18px;
  padding: 36px 44px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.drop-overlay-icon {
  font-size: 46px;
  margin-bottom: 10px;
}
.drop-overlay-box h3 {
  font-size: 17px;
  color: var(--zalo-blue);
  margin-bottom: 6px;
}
.drop-overlay-box p {
  font-size: 13px;
  color: var(--text-secondary);
}

.chat-header {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-title { font-size: 16px; font-weight: 700; }
.chat-title-edit-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1;
  opacity: 0.65;
  transition: opacity 0.12s, background 0.12s;
}
.chat-title-edit-btn:hover {
  opacity: 1;
  background: var(--bg-hover);
}
.chat-sub { font-size: 12.5px; color: var(--text-secondary); }
.chat-sub.online { color: #16a34a; font-weight: 500; }

/* Pinned Messages Banner */
.pinned-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 15;
  flex-shrink: 0;
}
.pinned-bar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.12s;
}
.pinned-bar-main:hover {
  background: var(--bg-hover);
}
.pinned-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.pinned-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.pinned-info {
  min-width: 0;
  flex: 1;
}
.pinned-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--zalo-blue);
}
.pinned-text {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pinned-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.pinned-count-btn {
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pinned-count-btn:hover {
  background: var(--zalo-blue-soft);
  color: var(--zalo-blue);
}
.pinned-dropdown {
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.pinned-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}
.pinned-item:hover { background: var(--bg-hover); }
.pinned-item:last-child { border-bottom: none; }

.msg-pin-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--zalo-blue);
  margin-bottom: 4px;
}

.msg-fwd-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.msg-edited-tag {
  font-size: 10.5px;
  font-style: italic;
  color: var(--text-muted);
  margin-left: 4px;
}

.edit-banner .reply-banner-content {
  border-left-color: #f59e0b;
}

.forward-preview {
  background: var(--bg-input);
  border-left: 3px solid var(--zalo-blue);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-word;
}

.delete-choice-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@keyframes msg-highlight-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 104, 255, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(0, 104, 255, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(0, 104, 255, 0); }
}
.msg-bubble.highlighted {
  animation: msg-highlight-pulse 1.2s ease-out;
  outline: 2px solid var(--zalo-blue);
}

/* Messages Area */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-divider {
  align-self: center;
  background: rgba(0, 0, 0, 0.14);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 999px;
  margin: 8px 0;
}

.system-msg {
  align-self: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 74%;
  position: relative;
}
.msg-row.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-row.theirs {
  align-self: flex-start;
}

.msg-body-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.msg-row.mine .msg-body-wrap { align-items: flex-end; }
.msg-row.theirs .msg-body-wrap { align-items: flex-start; }

.msg-sender-name {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-left: 4px;
  font-weight: 600;
}

.msg-bubble-line {
  display: flex;
  align-items: center;
  gap: 6px;
}
.msg-row.mine .msg-bubble-line { flex-direction: row-reverse; }

.msg-bubble {
  position: relative;
  background: var(--bubble-theirs);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  word-break: break-word;
  white-space: normal;
  width: fit-content;
  max-width: 100%;
}

/* Zalo-style bottom-right corner reaction trigger & hover pill */
.msg-react-corner {
  position: absolute;
  right: -6px;
  bottom: -10px;
  z-index: 12;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}
.msg-row:hover .msg-react-corner,
.msg-react-corner:hover {
  opacity: 1;
  pointer-events: auto;
}
.msg-react-trigger {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 0.12s, color 0.12s;
}
.msg-react-trigger:hover {
  color: var(--zalo-blue);
  transform: scale(1.1);
}
[data-theme="dark"] .msg-react-trigger {
  background: #252a32;
  border-color: #3a404a;
}

.msg-react-tray {
  position: absolute;
  bottom: 26px;
  right: -4px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.92);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  white-space: nowrap;
}
[data-theme="dark"] .msg-react-tray {
  background: #23272e;
  border-color: #383e48;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}
.msg-row.theirs .msg-react-tray {
  right: auto;
  left: -95px;
}
.msg-react-corner:hover .msg-react-tray {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.msg-react-tray::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 12px;
}
.msg-react-opt {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  padding: 2px 3px;
  cursor: pointer;
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}
.msg-react-opt:hover {
  transform: scale(1.32) translateY(-3px);
}
.msg-text {
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-row.mine .msg-bubble {
  background: var(--bubble-mine);
  border: 1px solid var(--bubble-mine-border);
}
.msg-bubble.recalled {
  font-style: italic;
  color: var(--text-muted);
  background: var(--bg-input) !important;
  border: 1px dashed var(--border);
}

.msg-reply-box {
  background: rgba(0, 104, 255, 0.08);
  border-left: 3px solid var(--zalo-blue);
  padding: 5px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.14s ease;
}
.msg-reply-box:hover {
  background: rgba(0, 104, 255, 0.17);
}
.msg-reply-thumb {
  width: 38px;
  height: 38px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.msg-reply-meta {
  min-width: 0;
  flex: 1;
}
.msg-reply-box strong { display: block; color: var(--zalo-blue); }
.msg-reply-box span { color: var(--text-secondary); }

.msg-image {
  max-width: 280px;
  max-height: 280px;
  border-radius: 8px;
  display: block;
  cursor: zoom-in;
  margin-top: 2px;
}

.msg-file-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-primary);
  min-width: 240px;
  max-width: 340px;
}
.msg-file-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.file-badge-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  color: #fff;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.file-badge-thumb.sm {
  width: 36px;
  height: 36px;
  border-radius: 7px;
  font-size: 9.5px;
}
.file-badge-thumb.pdf { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.file-badge-thumb.xls { background: linear-gradient(135deg, #22c55e, #15803d); }
.file-badge-thumb.doc { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.file-badge-thumb.ppt { background: linear-gradient(135deg, #f97316, #c2410c); }
.file-badge-thumb.zip { background: linear-gradient(135deg, #f59e0b, #b45309); }
.file-badge-thumb.generic { background: linear-gradient(135deg, #64748b, #334155); }

.msg-file-info {
  min-width: 0;
  flex: 1;
}
.msg-file-name {
  font-weight: 600;
  font-size: 13px;
  word-break: break-word;
  line-height: 1.35;
}
.msg-file-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.msg-pdf-preview-wrap {
  position: relative;
  width: 100%;
  height: 170px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
.msg-pdf-preview {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
}
.msg-pdf-preview-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
}
.msg-file-actions {
  display: flex;
  gap: 8px;
}
.msg-file-btn {
  flex: 1;
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.msg-file-btn:hover {
  background: var(--zalo-blue-soft);
  border-color: var(--zalo-blue);
  color: var(--zalo-blue);
}

.msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

/* Hover actions */
.msg-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 4px;
  box-shadow: var(--shadow-sm);
}
.msg-row:hover .msg-actions { opacity: 1; }
.msg-act-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.12s, transform 0.1s;
}
.msg-act-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.08);
}
.msg-act-btn.act-reply {
  color: #2580ff;
}
.msg-act-btn.act-forward {
  color: #10b981;
}

/* Reactions */
.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.reaction-pill {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.reaction-pill.active {
  border-color: var(--zalo-blue);
  background: var(--zalo-blue-soft);
}

.typing-bar {
  padding: 4px 22px 6px;
  font-size: 12.5px;
  color: var(--zalo-blue);
  font-style: italic;
}

/* Reply Banner */
.reply-banner {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.reply-banner-content {
  border-left: 3px solid var(--zalo-blue);
  padding-left: 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.reply-label { font-size: 12px; color: var(--text-secondary); }
.reply-preview-text {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Composer */
.composer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.composer-toolbar {
  padding: 5px 10px 4px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
}
.composer-toolbar .icon-btn {
  width: 28px;
  height: 28px;
  font-size: 16px;
  flex-shrink: 0;
}
.emoji-wrap { position: relative; }
.emoji-popover {
  position: absolute;
  bottom: 42px;
  left: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  box-shadow: var(--shadow-md);
  z-index: 50;
  width: 280px;
}
.emoji-btn {
  border: none;
  background: transparent;
  font-size: 20px;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
}
.emoji-btn:hover { background: var(--bg-hover); }

/* Price Lookup Popover */
.price-lookup-wrap {
  position: relative;
  margin-left: 4px;
}
.toolbar-pill-btn {
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.toolbar-pill-btn:hover,
.toolbar-pill-btn.active {
  background: var(--zalo-blue-soft);
  border-color: var(--zalo-blue);
  color: var(--zalo-blue);
}
.price-lookup-popover {
  position: absolute;
  bottom: 44px;
  left: 0;
  width: min(430px, 86vw);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  z-index: 60;
  overflow: hidden;
}
.price-lookup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--zalo-blue);
}
.price-lookup-search {
  padding: 6px 14px 10px;
  border-bottom: 1px solid var(--border);
}
.price-lookup-search input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
}
.price-lookup-search input:focus {
  border-color: var(--zalo-blue);
  box-shadow: 0 0 0 3px rgba(0, 104, 255, 0.14);
}
.price-lookup-results {
  max-height: 290px;
  overflow-y: auto;
  padding: 6px;
}
.price-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s;
}
.price-item-row:hover,
.price-item-row.selected {
  background: var(--zalo-blue-soft);
}
.price-item-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-input);
}
.price-item-main {
  min-width: 0;
  flex: 1;
}
.price-item-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
}
.price-item-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.price-item-right {
  text-align: right;
  flex-shrink: 0;
}
.price-item-price {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--zalo-blue);
}
.price-item-discount {
  display: inline-block;
  margin-top: 2px;
  background: rgba(239, 68, 68, 0.14);
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 2px;
}
.catalog-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.14s, transform 0.1s;
}
.catalog-card:hover {
  border-color: var(--zalo-blue);
  transform: translateY(-1px);
}
.catalog-card-img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 7px;
  background: var(--bg-input);
}
.news-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.news-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.news-card-title {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--zalo-blue);
}
.news-card-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}
.news-card-body {
  font-size: 13.5px;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 14px;
}
.composer-input-row textarea {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  max-height: 120px;
  line-height: 1.45;
  padding: 4px 0;
}
.send-btn {
  padding: 8px 18px;
  flex-shrink: 0;
}

/* 4. Info Drawer */
.info-drawer {
  width: 300px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.info-drawer-header {
  height: 64px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.info-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.info-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.info-section h4 {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.media-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  cursor: zoom-in;
}

/* ===== MODALS ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-box {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.check-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}
.check-item:hover { background: var(--bg-hover); }

.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}
.color-swatch.selected {
  border-color: var(--text-primary);
  transform: scale(1.1);
}

/* ===== ADMIN MANAGEMENT PANEL ===== */
.admin-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  min-width: 0;
  overflow: hidden;
}
.admin-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.admin-header h2 {
  font-size: 19px;
  color: var(--text-primary);
}
.admin-subtitle {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.admin-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-stat-pill {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-secondary);
}
.admin-stat-pill strong {
  color: var(--zalo-blue);
  font-size: 15px;
  margin-left: 4px;
}
.admin-toolbar {
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-tabs {
  display: flex;
  gap: 8px;
}
.admin-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-content {
  flex: 1;
  overflow: auto;
  padding: 0 24px 24px;
}
.admin-table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}
.admin-table th,
.admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.admin-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
}
.admin-table tr:last-child td {
  border-bottom: none;
}
.admin-table tbody tr:hover {
  background: var(--bg-hover);
}
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.role-badge.admin {
  background: var(--zalo-blue-soft);
  color: var(--zalo-blue);
}
.role-badge.member {
  background: var(--bg-input);
  color: var(--text-secondary);
}
.role-badge.pending {
  background: rgba(245, 158, 11, 0.18);
  color: #d97706;
}
.role-badge.approved {
  background: rgba(34, 197, 94, 0.16);
  color: #16a34a;
}
.btn-approve {
  background: #16a34a;
  color: #fff;
}
.btn-approve:hover {
  background: #15803d;
}
.member-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 340px;
}
.member-chip {
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 999px;
}

/* ===== CALL & VIDEO CALL OVERLAY ===== */
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.call-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  padding: 20px;
}

.incoming-call-card {
  width: 100%;
  max-width: 340px;
  background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
  color: #fff;
  border-radius: 22px;
  padding: 36px 24px 28px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.incoming-call-card h3 {
  font-size: 20px;
  margin-top: 16px;
}
.call-status-text {
  color: #94a3b8;
  font-size: 14px;
  margin-top: 6px;
}
.incoming-call-actions {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin-top: 28px;
}

.call-avatar-ring {
  display: inline-flex;
  padding: 8px;
  border-radius: 50%;
  background: rgba(0, 104, 255, 0.25);
  animation: call-pulse 1.6s infinite ease-out;
}
@keyframes call-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 104, 255, 0.55); }
  70% { box-shadow: 0 0 0 22px rgba(0, 104, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 104, 255, 0); }
}

.call-circle-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s;
}
.call-circle-btn:hover { filter: brightness(1.1); transform: scale(1.05); }
.call-circle-btn.accept { background: #22c55e; }
.call-circle-btn.danger { background: #ef4444; }

.call-stage {
  position: relative;
  width: min(920px, 94vw);
  height: min(620px, 86vh);
  background: #0f172a;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}
.call-stage.audio-mode {
  width: min(420px, 92vw);
  height: min(480px, 82vh);
}

.remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #020617;
}
.call-stage.audio-mode .remote-video,
.call-stage.audio-mode .local-video {
  display: none;
}

.local-video {
  position: absolute;
  top: 64px;
  right: 18px;
  width: 180px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  background: #1e293b;
  transform: scaleX(-1);
  z-index: 10;
}

.call-audio-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: radial-gradient(circle at top, #1e3a8a 0%, #0f172a 70%);
  z-index: 5;
}
.call-audio-placeholder h2 {
  font-size: 22px;
  margin-top: 16px;
}
.call-stage.video-connected .call-audio-placeholder {
  display: none;
}

.call-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.65) 0%, transparent 100%);
  z-index: 15;
  font-weight: 600;
}
.call-timer {
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
}

.call-controls {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(10px);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  z-index: 20;
}

.call-ctrl-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.call-ctrl-btn:hover { background: rgba(255, 255, 255, 0.28); }
.call-ctrl-btn.off {
  background: #ef4444;
}
.call-ctrl-btn.active {
  background: var(--zalo-blue);
}

/* ===== VOICE MESSAGE & SPEECH-TO-TEXT ===== */
.voice-record-bar {
  background: rgba(239, 68, 68, 0.09);
  border-top: 1px solid rgba(239, 68, 68, 0.3);
  padding: 9px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.voice-rec-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-primary);
}
.voice-rec-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ef4444;
  animation: rec-blink 1s infinite;
}
@keyframes rec-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}
.voice-rec-timer {
  font-variant-numeric: tabular-nums;
  color: #ef4444;
  font-size: 14px;
}
.voice-rec-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-pill-btn.listening {
  background: rgba(239, 68, 68, 0.16);
  border-color: #ef4444;
  color: #ef4444;
  animation: rec-blink 1.2s infinite;
}

.msg-voice-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 240px;
}
.msg-voice-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--zalo-blue);
}
.msg-voice-audio {
  width: 250px;
  max-width: 100%;
  height: 36px;
  outline: none;
}

/* ===== CART & ORDER TABLE ===== */
.cart-header-btn {
  position: relative;
}
.cart-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-box.modal-wide {
  max-width: 760px;
}

.cart-item-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.cart-item-summary img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.cart-qty-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.cart-qty-actions .btn {
  flex: 1;
}

.order-table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
}
.order-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.order-table th,
.order-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: middle;
}
.order-table th {
  background: var(--bg-subtle);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.order-table tr:last-child td {
  border-bottom: none;
}
.order-table input.order-inline-input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.order-table input.order-inline-input:focus {
  border-color: var(--zalo-blue);
}
.order-footer-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* Order Card rendered inside chat bubble */
.order-chat-card {
  min-width: 340px;
  max-width: 100%;
}
.order-chat-title {
  font-weight: 700;
  color: var(--zalo-blue);
  margin-bottom: 6px;
  font-size: 14px;
}
.order-chat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: var(--bg-surface);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.order-chat-table th,
.order-chat-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}
.order-chat-table th {
  background: var(--bg-subtle);
  font-weight: 700;
  color: var(--text-secondary);
}
.order-chat-table tr:last-child td {
  border-bottom: none;
}
/* Numbers must never break across lines ("20" read as "2" / "0") */
.order-chat-table th,
.order-chat-table td:first-child,
.order-chat-table td:nth-child(4) {
  white-space: nowrap;
}

/* ===== PRICE QUOTE CARD: one row, five columns, thumbnail ===== */
.quote-card {
  width: 440px;
  max-width: 100%;
}
.quote-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.quote-thumb {
  width: 56px;
  height: 56px;
  flex: none;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: zoom-in;
}
.quote-title {
  font-weight: 700;
  color: var(--zalo-blue);
  font-size: 14px;
}
.quote-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.quote-table th,
.quote-table td {
  padding: 6px;
  text-align: right;
  white-space: nowrap;
  vertical-align: top;
}
.quote-table th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
}
.quote-table th:first-child,
.quote-table td.quote-name {
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.quote-table td.quote-name { font-weight: 600; }
.quote-table th:nth-child(2),
.quote-table td:nth-child(2) { text-align: center; }
.quote-table td.quote-price { font-weight: 700; color: var(--zalo-blue); }
.quote-note {
  margin-top: 4px;
  font-size: 12.5px;
}

/* ===== MESSAGE CONTEXT MENU (Zalo-style) ===== */
.ctx-menu {
  position: fixed;
  z-index: 320;
  min-width: 230px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 0;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
  user-select: none;
  animation: ctx-pop 0.1s ease-out;
}
[data-theme="dark"] .ctx-menu {
  background: #23272e;
  border-color: #363c46;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}
@keyframes ctx-pop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.ctx-react-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 6px;
  gap: 2px;
}
.ctx-react-btn {
  border: none;
  background: transparent;
  font-size: 19px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, background 0.12s;
}
.ctx-react-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.2);
}

.ctx-divider {
  height: 1px;
  background: var(--border);
  margin: 5px 0;
}
[data-theme="dark"] .ctx-divider {
  background: #333942;
}

.ctx-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.ctx-item:hover {
  background: var(--bg-hover);
}
[data-theme="dark"] .ctx-item:hover {
  background: #2f353f;
}
.ctx-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-secondary);
}
.ctx-item.danger {
  color: #ef4444;
}
.ctx-item.danger svg {
  color: #ef4444;
}

/* Lightbox & Toast */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
}
.toast {
  background: #111827;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
}
.toast.error { background: #b91c1c; }
.toast.success { background: #15803d; }

/* ===== LABELS, SEARCH, SEEN AVATARS, QUICK REPLIES, INFO TABS, MOBILE ===== */
.label-filter-select {
  margin-left: auto;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.conv-label-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.chat-search-bar {
  position: relative;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 18;
}
.chat-search-bar input {
  flex: 1;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
}
.chat-search-results {
  position: absolute;
  top: 100%;
  left: 16px;
  right: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  max-height: 280px;
  overflow-y: auto;
  z-index: 30;
}
.chat-search-item {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}
.chat-search-item:hover { background: var(--bg-hover); }
.chat-search-item:last-child { border-bottom: none; }

/* Seen Avatars Row */
.seen-row {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: -4px;
  padding-right: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.seen-mini-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: #fff;
  font-size: 8.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bg-canvas);
}

/* Quick Replies Popover */
.composer {
  position: relative;
}
.quick-reply-popover {
  position: absolute;
  bottom: 100%;
  left: 14px;
  width: min(400px, 90vw);
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  z-index: 65;
  padding: 6px;
  margin-bottom: 6px;
}
.qr-item {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.qr-item:hover,
.qr-item.selected {
  background: var(--zalo-blue-soft);
}
.qr-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}
.qr-code {
  background: var(--zalo-blue);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px;
}
.qr-preview {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Info Drawer Tabs */
.info-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--bg-input);
  padding: 3px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.info-tab-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.info-tab-btn.active {
  background: var(--bg-surface);
  color: var(--zalo-blue);
  box-shadow: var(--shadow-sm);
}

.mobile-only {
  display: none !important;
}

/* Clickable Missed/Ended Call System Pill */
.system-msg.call-log {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.system-msg.call-log:hover {
  border-color: var(--zalo-blue);
  background: var(--zalo-blue-soft);
  transform: translateY(-1px);
}
.call-log-retry {
  background: var(--zalo-blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Tablet breakpoint (must come BEFORE mobile <=768px so it never overrides smartphone) */
@media (max-width: 960px) and (min-width: 769px) {
  .sidebar { width: 260px; }
  .info-drawer { position: fixed; right: 0; top: 0; bottom: 0; z-index: 60; box-shadow: var(--shadow-md); }
}

/* Smartphone Layout (Zalo Mobile style: bottom nav bar on list, full-screen chat when open) */
@media (max-width: 768px) {
  html, body {
    overflow: hidden;
    width: 100%;
    height: 100%;
  }

  .mobile-only {
    display: inline-flex !important;
  }

  .app-shell {
    flex-direction: column-reverse;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
  }

  /* Bottom Navigation Bar */
  .nav-rail {
    width: 100%;
    height: calc(54px + env(safe-area-inset-bottom, 0px));
    padding: 4px 10px calc(4px + env(safe-area-inset-bottom, 0px));
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    z-index: 30;
  }
  .nav-top, .nav-bottom {
    flex-direction: row;
    align-items: center;
    gap: 4px;
  }
  .rail-avatar-btn {
    margin-bottom: 0;
    margin-right: 4px;
  }
  .rail-avatar-btn .avatar-md {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }
  .rail-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }
  .ws-dot {
    display: none;
  }

  /* Full-width Sidebar when browsing chats/contacts */
  .sidebar {
    width: 100%;
    max-width: none;
    flex: 1;
    min-height: 0;
    border-right: none;
  }
  .sidebar-header {
    height: 54px;
    padding: 8px 10px;
  }
  .filter-tabs {
    padding: 8px 10px 6px;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .label-filter-select {
    max-width: 135px;
    font-size: 12px;
  }

  /* Full-screen Chat View when a conversation is open */
  .chat-main {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  .app-shell.mobile-chat-open .sidebar,
  .app-shell.mobile-chat-open .nav-rail {
    display: none !important;
  }
  .app-shell:not(.mobile-chat-open) .chat-main {
    display: none !important;
  }

  /* Compact Chat Header so all icons fit on 360px-430px phones */
  .chat-header {
    height: 54px;
    padding: 0 6px;
    gap: 4px;
  }
  .chat-header-left {
    gap: 6px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }
  .chat-header-left .avatar-md {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  .chat-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
    display: inline-block;
  }
  #chat-header-label {
    display: none !important;
  }
  .chat-sub {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .chat-header-actions {
    display: flex;
    align-items: center;
    gap: 1px;
    flex-shrink: 0;
  }
  .chat-header-actions .icon-btn {
    width: 30px;
    height: 30px;
    font-size: 15px;
    padding: 0;
  }
  .chat-header-actions .icon-btn svg {
    width: 17px;
    height: 17px;
  }

  /* In-chat Search Bar & Pinned Bar */
  .chat-search-bar {
    padding: 6px 8px;
  }
  .pinned-bar-main {
    padding: 6px 10px;
  }

  /* Messages & Bubbles */
  .messages-container {
    padding: 10px 8px;
    gap: 8px;
  }
  .msg-row {
    max-width: 88%;
    gap: 6px;
  }
  .msg-bubble {
    padding: 7px 10px;
    font-size: 14px;
    max-width: 100%;
  }
  .msg-image {
    max-width: 100%;
    max-height: 240px;
  }
  .msg-file-card {
    max-width: 100%;
    min-width: 0;
  }
  .msg-pdf-preview-wrap {
    max-width: 100%;
  }
  .order-bubble-wrap,
  .order-table-scroll {
    max-width: calc(100vw - 72px);
    overflow-x: auto;
  }

  /* Composer & Horizontally Scrollable Single-Row Toolbar */
  .composer-toolbar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 5px 8px;
    gap: 4px;
  }
  .composer-toolbar::-webkit-scrollbar {
    display: none;
  }
  .toolbar-pill-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 4px 9px;
    font-size: 12px;
  }
  .composer-input-row {
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    gap: 6px;
  }
  #message-input {
    font-size: 16px;
    padding: 8px 10px;
  }
  .send-btn {
    padding: 8px 14px;
    font-size: 13.5px;
  }

  /* Fixed Popovers so toolbar overflow-x never clips them */
  .emoji-popover,
  .price-lookup-popover,
  .quick-reply-popover {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    max-width: none !important;
    z-index: 95 !important;
  }
  .price-lookup-popover {
    max-height: 60dvh;
  }

  /* Full-screen Info Drawer & Responsive Modals */
  .info-drawer {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    z-index: 80;
    box-shadow: var(--shadow-md);
  }
  .modal-box,
  .modal-box.wide {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: 90dvh;
    padding: 14px;
    border-radius: 12px;
  }
  .auth-card {
    width: calc(100vw - 24px);
    padding: 22px 16px;
  }

  /* Admin Panel on Smartphone */
  .admin-view {
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 12px;
    overflow-y: auto;
  }
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .admin-stats {
    flex-wrap: wrap;
    gap: 6px;
  }
  .admin-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .admin-tabs {
    flex-wrap: wrap;
  }
  .admin-table-card {
    overflow-x: auto;
  }
}

/* ===== Phone layout: compact header, toolbar and order card ===== */
@media (max-width: 768px) {
  /* Secondary actions move into the "more" / "shop" menus */
  #btn-edit-nickname,
  #btn-video-call,
  #btn-conv-label,
  #btn-conv-search,
  #btn-conv-mute,
  #btn-toggle-info,
  #btn-catalog,
  #btn-new-arrivals,
  #btn-promos,
  #btn-news,
  #btn-quick-reply {
    display: none !important;
  }
  .chat-title { max-width: 100%; }
  .chat-header-left > div:last-child { flex: 1; }
  .chat-header-actions { gap: 4px; }
  .chat-header-actions .icon-btn { width: 38px; height: 38px; }
  .chat-header-actions .icon-btn svg { width: 20px; height: 20px; }
  .price-lookup-wrap { margin-left: 0; }
  #mobile-menu .ctx-item { padding: 12px 16px; font-size: 14.5px; }

  /* Order rows become cards: name and quantity on top, unit and note below */
  .order-chat-card { min-width: 0; width: 100%; }
  .order-chat-table,
  .order-chat-table tbody { display: block; }
  .order-chat-table thead { display: none; }
  .order-chat-table tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: 8px;
    padding: 7px 9px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .order-chat-table tr:last-child { border-bottom: none; }
  .order-chat-table td { display: block; padding: 0; border: none; }
  .order-chat-table td:nth-child(1) { grid-area: 1 / 1; color: var(--text-secondary); }
  .order-chat-table td:nth-child(1)::after { content: "."; }
  .order-chat-table td:nth-child(2) { grid-area: 1 / 2; }
  .order-chat-table td:nth-child(3) { grid-area: 2 / 2; color: var(--text-secondary); }
  .order-chat-table td:nth-child(4) { grid-area: 1 / 3; text-align: right; }
  .order-chat-table td:nth-child(4)::before { content: "SL: "; font-weight: 500; color: var(--text-secondary); }
  .order-chat-table td:nth-child(5) { grid-area: 3 / 2 / 4 / 4; font-style: italic; }
  .order-chat-table td:nth-child(5):empty { display: none; }
  .order-chat-table td:nth-child(5)::before { content: "Ghi chú: "; font-style: normal; color: var(--text-secondary); }
  .msg-row:has(.order-chat-card, .quote-card) { width: 88%; }
  .msg-row:has(.order-chat-card, .quote-card) .msg-body-wrap,
  .msg-row:has(.order-chat-card, .quote-card) .msg-bubble-line,
  .msg-row:has(.order-chat-card, .quote-card) .msg-bubble { flex: 1; min-width: 0; }
  /* Order card takes the full row; message actions wrap above it */
  .msg-row:has(.order-chat-card, .quote-card) .msg-bubble-line { flex-wrap: wrap; }
  .msg-row:has(.order-chat-card, .quote-card) .msg-bubble { flex-basis: 100%; }
  .msg-row:has(.order-chat-card, .quote-card) .msg-actions { order: -1; }
  .msg-row.theirs:has(.order-chat-card, .quote-card) .msg-react-tray { left: auto; right: -4px; }
  .quote-card { width: 100%; }
  .quote-table { font-size: 11.5px; }
  .quote-table th,
  .quote-table td { padding: 5px 3px; }
  .messages-container { overflow-x: hidden; }
  .composer-toolbar { gap: 3px; padding-left: 6px; padding-right: 6px; }
  .composer-toolbar .toolbar-pill-btn { padding: 4px 7px; gap: 3px; }
}

@media (max-width: 374px) {
  .composer-toolbar .toolbar-pill-btn { padding: 4px 5px; }
}

/* ===== Icon system ===== */
.ic {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
  flex-shrink: 0;
  pointer-events: none;
}
#i-more circle { fill: currentColor; }
.icon-btn .ic { width: 20px; height: 20px; }
.rail-btn .ic, .theme-float-btn .ic, .call-ctrl-btn .ic { width: 22px; height: 22px; }
.toolbar-pill-btn .ic { width: 15px; height: 15px; }
.chat-title-edit-btn .ic, .conv-edit-nick-btn .ic { width: 14px; height: 14px; }
.avatar .ic { width: 55%; height: 55%; }
.search-box .ic.search-icon { width: 16px; height: 16px; }
.welcome-icon .ic, .drop-overlay-icon .ic { width: 1em; height: 1em; color: var(--zalo-blue); }
.btn .ic { margin-right: 2px; }

/* ===== Readability: larger secondary text and hit areas ===== */
.conv-time, .msg-time { font-size: 12.5px; }
.conv-preview { font-size: 14px; }
.contact-sub, .msg-sender-name, .msg-file-sub, .system-msg, .pinned-title { font-size: 13px; }
.pinned-text, .chat-sub { font-size: 13.5px; }
.msg-bubble { font-size: 15px; }
.toolbar-pill-btn { font-size: 12.5px; min-height: 32px; }
.filter-tab { min-height: 32px; }
.icon-btn { width: 36px; height: 36px; }
.composer-toolbar .icon-btn { width: 34px; height: 34px; }
.msg-act-btn { min-width: 30px; min-height: 30px; }
.chat-title-edit-btn, .conv-edit-nick-btn { min-width: 26px; min-height: 26px; }

@media (max-width: 768px) {
  /* 16px inputs stop iOS from auto-zooming on focus now that pinch zoom is allowed */
  input, select, textarea { font-size: 16px !important; }
  .label-filter-select { max-width: 150px; }
  .msg-bubble { font-size: 15.5px; }
  .chat-sub { font-size: 12.5px; }
  .chat-header-actions .icon-btn { width: 40px; height: 40px; }
  #btn-mobile-back { width: 40px; height: 40px; }
  .composer-toolbar { gap: 2px; }
  .composer-toolbar .icon-btn { width: 34px; height: 38px; }
  .composer-toolbar .toolbar-pill-btn { min-height: 36px; font-size: 12.5px; }
  #btn-speech-to-text .lbl { display: none; }
  #btn-speech-to-text { min-width: 36px; justify-content: center; }
  .msg-act-btn { min-width: 32px; min-height: 32px; }
}
@media (max-width: 374px) {
  .composer-toolbar .icon-btn { width: 31px; }
}
