/* Giao diện Hệ thống Chăm sóc Khách hàng Đa ngữ (Urdu - English - Đông Nam Á) */
:root {
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #ecfdf5;
  --agent-bg: #1e293b;
  --agent-card: #334155;
  --bubble-customer: #f1f5f9;
  --bubble-agent: #10b981;
  --bubble-bot: #eff6ff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  background-color: #f8fafc;
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Hỗ trợ chữ Urdu từ phải sang trái (RTL) - Dùng font sans-serif chuẩn để kích thước bong bóng ôm sát nội dung */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.urdu-font, [dir="rtl"] .urdu-font {
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", "Segoe UI", Tahoma, sans-serif;
  line-height: 1.35;
  display: inline-block;
}

/* ==================== GIAO DIỆN KHÁCH HÀNG (CUSTOMER) ==================== */
.customer-container {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  overflow-x: hidden !important;
  box-sizing: border-box;
}

.chat-header {
  background: linear-gradient(135deg, #059669, #047857);
  color: white;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  gap: 6px;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.avatar-badge {
  position: relative;
  flex-shrink: 0;
}

.avatar-img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #059669;
  font-weight: bold;
}

.status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  background: #22c55e;
  border: 1.5px solid white;
  border-radius: 50%;
}

.chat-header-text {
  min-width: 0;
  overflow: hidden;
}

.chat-header-text h3 {
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-text p {
  font-size: 11px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-switch-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  padding: 3.5px 7px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.lang-switch-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Thanh 5 nút tiện ích liên kết ngoài phía khách hàng */
.cust-action-buttons-bar {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  overflow-x: hidden !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  z-index: 10;
}
.cust-action-buttons-bar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
.cust-action-btn-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3.5px 7px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
}
.cust-action-btn-item:hover {
  background: #f1f5f9;
  border-color: #059669;
  color: #059669;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}
.cust-action-btn-item:active {
  transform: translateY(0);
}
.cust-action-btn-item .btn-icon {
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
}
.cust-action-btn-item .btn-title {
  font-size: 10.5px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Danh sách tin nhắn */
.messages-box {
  flex: 1;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
}

.messages-box .chat-img-box {
  margin-top: 4px;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden;
}

.messages-box .chat-msg-img {
  max-width: 100% !important;
  max-height: 220px;
  width: auto;
  height: auto;
  object-fit: contain !important;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  box-sizing: border-box !important;
  display: block;
}

.messages-box .chat-video-box {
  margin-top: 4px;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden;
}

.messages-box .chat-msg-video {
  max-width: 100% !important;
  max-height: 220px;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-sizing: border-box !important;
}

.messages-box .chat-file-card {
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  box-sizing: border-box !important;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-row.customer {
  align-self: flex-end;
  align-items: flex-end; /* Giúp bong bóng ôm sát nội dung theo chiều ngang */
}

.msg-row.agent, .msg-row.bot {
  align-self: flex-start;
  align-items: flex-start; /* Giúp bong bóng ôm sát nội dung theo chiều ngang */
}

.msg-bubble {
  display: inline-block;
  width: fit-content;
  max-width: 100% !important;
  padding: 5px 9px !important; /* Ôm sát chữ cực kỳ khít khao, không còn viền ngoài rộng thừa thãi */
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  box-sizing: border-box !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  white-space: normal;
  overflow: hidden;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  transition: all 0.15s ease-in-out;
}

.chat-msg-text {
  display: inline-block;
  line-height: 1.4;
  margin: 0;
  padding: 0;
  max-width: 100% !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  box-sizing: border-box !important;
}

.msg-row.customer .msg-bubble {
  background: #ecfdf5 !important; /* Gam màu xanh ngọc pastel nhạt dịu mát, không chói mắt */
  color: #065f46 !important; /* Chữ xanh sẫm tự nhiên, độ tương phản sắc nét */
  font-weight: 500;
  border: 1px solid #bbf7d0 !important; /* Viền nhạt thanh tao, ôm sát nội dung */
  border-bottom-right-radius: 2px !important;
  text-align: left;
}

.msg-row.agent .msg-bubble {
  background: #f8fafc !important; /* Gam màu ngọc trai xám khói pastel nhã nhặn */
  color: #0f172a !important; /* Chữ đậm rõ nét */
  font-weight: 500;
  border: 1px solid #e2e8f0 !important; /* Viền nhạt thanh tao, ôm sát nội dung */
  border-bottom-left-radius: 2px !important;
  text-align: left;
}

.msg-row.bot .msg-bubble {
  background: #f0f7ff !important; /* Gam màu xanh băng pastel nhạt êm dịu */
  color: #1e3a8a !important; /* Chữ xanh biển dịu mắt */
  font-weight: 500;
  border: 1px solid #bfdbfe !important; /* Viền nhạt thanh tao, ôm sát nội dung */
  border-bottom-left-radius: 2px !important;
  text-align: left;
}

.msg-badge {
  font-size: 11px;
  margin-bottom: 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.msg-row.bot .msg-badge {
  color: #2563eb;
}

.msg-row.agent .msg-badge {
  color: #059669;
}

.msg-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-row.customer .msg-meta {
  justify-content: flex-end;
}

/* Các câu hỏi gợi ý nhanh (FAQ Chips) */
.faq-chips-container {
  padding: 8px 10px;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow-x: hidden !important;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.faq-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: normal;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

.faq-chip:hover {
  background: #ecfdf5;
  border-color: #059669;
  color: #059669;
}

/* Khung soạn thảo tin nhắn */
.input-area {
  padding: 8px 10px;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}

.input-area textarea {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  resize: none;
  height: 42px;
  max-height: 100px;
  outline: none;
  transition: border-color 0.2s;
}

.input-area textarea:focus {
  border-color: #059669;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15);
}

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #059669;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, transform 0.1s;
}

.send-btn:hover {
  background: #047857;
  transform: scale(1.05);
}

/* ==================== GIAO DIỆN NHÂN VIÊN CSKH (AGENT) ==================== */
.agent-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ==================== THANH TASKBAR ĐIỀU HƯỚNG DỌC BÊN TRÁI (LEFT DOCK TASKBAR) ==================== */
.agent-dock-taskbar {
  width: 64px;
  min-width: 64px;
  background: #0f172a;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 16px 0;
  z-index: 100;
  user-select: none;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.08);
}

.dock-top-group, .dock-bottom-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.dock-app-brand {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  margin-bottom: 8px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
  cursor: pointer;
  transition: transform 0.2s;
}
.dock-app-brand:hover {
  transform: scale(1.05);
}

.dock-item {
  width: 48px;
  height: 50px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  outline: none;
}

.dock-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
}

.dock-item.active {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
  border-left: 3px solid #3b82f6;
  border-radius: 0 10px 10px 0;
}

.dock-icon {
  font-size: 19px;
  line-height: 1;
}

.dock-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.dock-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

#dockOthersBadge {
  background: #6366f1;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.4);
}

.dock-item-profile {
  cursor: pointer;
  position: relative;
  margin-top: 4px;
}
.dock-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #334155;
  transition: border-color 0.2s;
}
.dock-item-profile:hover .dock-avatar {
  border-color: #3b82f6;
}
.dock-status-dot {
  position: absolute;
  bottom: 2px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #0f172a;
}
.dock-status-dot.stealth {
  background: #f59e0b;
}

/* Flyout chọn ngôn ngữ từ taskbar */
.dock-lang-flyout {
  display: none;
  position: fixed;
  left: 72px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.22), 0 8px 16px -6px rgba(15, 23, 42, 0.12);
  width: 330px;
  z-index: 99999;
  padding: 16px;
  animation: fadeIn 0.15s ease-out;
}
.dock-lang-flyout.show {
  display: block !important;
}

.dock-item-telegram:hover {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8 !important;
}
.dock-item-telegram .dock-icon {
  color: #38bdf8;
  font-size: 20px;
}
.flyout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.flyout-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}
.flyout-close-btn {
  background: none;
  border: none;
  font-size: 14px;
  color: #64748b;
  cursor: pointer;
}
.flyout-form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}
.flyout-form-group select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  color: #1e293b;
  outline: none;
  background: #f8fafc;
}
.flyout-form-group select:focus {
  border-color: #3b82f6;
}

/* Cột danh sách khách hàng bên trái */
.agent-sidebar {
  width: 300px;
  min-width: 300px;
  background: white;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-top-bar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}
.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 6px 14px;
}
.sidebar-main-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-online-pill {
  font-size: 11px;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}

/* Trình chuyển đổi trạng thái Online / Offline / Ẩn thân của Nhân viên */
.agent-status-dropdown-wrap {
  position: relative;
  display: inline-block;
}

.btn-agent-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-agent-status-pill.online {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}
.btn-agent-status-pill.online:hover {
  background: #dcfce7;
  border-color: #86efac;
}

.btn-agent-status-pill.offline {
  background: #f1f5f9;
  color: #64748b;
  border-color: #cbd5e1;
}
.btn-agent-status-pill.offline:hover {
  background: #e2e8f0;
  color: #475569;
}

.btn-agent-status-pill.stealth {
  background: #fefce8;
  color: #a16207;
  border-color: #fde047;
}
.btn-agent-status-pill.stealth:hover {
  background: #fef9c3;
}

.status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.btn-agent-status-pill.online .status-indicator-dot {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
  animation: pulseDot 2s infinite;
}
.btn-agent-status-pill.offline .status-indicator-dot {
  background: #94a3b8;
}
.btn-agent-status-pill.stealth .status-indicator-dot {
  background: #eab308;
}

.status-caret {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 1px;
}

/* Agent Status Menu Dropdown */
.agent-status-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 250px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 1050;
  padding: 6px;
  animation: dropdownFadeIn 0.15s ease-out;
}

.agent-status-menu.show {
  display: block;
}

.status-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.status-menu-item:hover {
  background: #f1f5f9;
}
.status-menu-item.active {
  background: #eff6ff;
}

.status-menu-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-menu-dot.dot-online {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}
.status-menu-dot.dot-offline {
  background: #94a3b8;
}
.status-menu-dot.dot-stealth {
  background: #eab308;
}

.status-menu-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.status-menu-info strong {
  font-size: 12.5px;
  color: #0f172a;
  line-height: 1.2;
}
.status-menu-sub {
  font-size: 11px;
  color: #64748b;
  line-height: 1.2;
}

.status-check {
  font-size: 13px;
  color: #2563eb;
  font-weight: 700;
  flex-shrink: 0;
}

/* Style cho các chip filter Online / Offline danh sách hội thoại */
.conv-filter-chip.chip-online.active {
  background: #f0fdf4 !important;
  color: #15803d !important;
  border-color: #86efac !important;
}
.conv-filter-chip.chip-offline.active {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border-color: #94a3b8 !important;
}

.agent-header {
  padding: 16px;
  background: #0f172a;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.agent-title h2 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-lang-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #334155;
}

.agent-lang-selector label {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
}

.agent-lang-selector select {
  background: transparent;
  color: white;
  border: none;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  width: 100%;
}

.agent-lang-selector select option {
  background: #1e293b;
  color: white;
}

.conv-list {
  flex: 1;
  overflow-y: auto;
}

/* Update #89: Tối ưu danh sách hội thoại gọn gàng, siêu tiết kiệm diện tích, hiển thị được nhiều cuộc đối thoại hơn */
.conv-item {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.conv-item:hover {
  background: #f8fafc;
}

.conv-item.active {
  background: #f0f6ff !important;
  border-left: 3px solid #3b82f6 !important;
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.08);
}

.conv-item.active .conv-avatar {
  background: #e0eeff;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
}

.conv-item.active .conv-name {
  color: #1d4ed8;
  font-weight: 700;
}

.conv-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.conv-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.conv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.conv-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conv-time {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}

.conv-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.conv-preview {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conv-indicators {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.conv-msg-bubble {
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  box-shadow: 0 1px 2px rgba(239, 68, 68, 0.25);
  line-height: 16px;
  white-space: nowrap;
}

.conv-wait-badge {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #ffedd5;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 6px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  line-height: 16px;
}

.badge-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.badge-bot { background: #dbeafe; color: #1e40af; }
.badge-waiting { background: #fef3c7; color: #92400e; }
.badge-active { background: #dcfce7; color: #166534; }

.unread-count {
  background: #ef4444;
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: bold;
}

/* Khu vực Chat của nhân viên */
.agent-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.agent-chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
}

.agent-chat-info h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-chat-info p {
  font-size: 12px;
  color: var(--text-muted);
}

.agent-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: white;
  cursor: pointer;
  font-weight: 500;
}

.btn-sm:hover {
  background: #f1f5f9;
}

.btn-primary-sm {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.btn-primary-sm:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

/* Tin nhắn trong khung nhìn của nhân viên */
.agent-msg-box {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 6px 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Update #90: Bong bóng trò chuyện siêu nhỏ gọn, đơn giản, hiện đại chuẩn Crisp/LiveChat */
.agent-bubble-container {
  display: flex;
  flex-direction: column;
  max-width: 80% !important;
  margin: 5px 0 !important;
}

.agent-bubble-container.from-customer {
  align-self: flex-start;
  align-items: flex-start;
}

.agent-bubble-container.from-agent {
  align-self: flex-end;
  align-items: flex-end;
}

.agent-bubble-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  line-height: 1.2;
}

.agent-bubble-header.left {
  justify-content: flex-start;
}

.agent-bubble-header.right {
  justify-content: flex-end;
}

.bubble-sender-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ede9fe;
  color: #7c3aed;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bubble-sender-name {
  font-weight: 600;
  color: #475569;
  font-size: 11.5px;
}

.bubble-msg-time {
  color: #94a3b8;
  font-size: 11px;
}

.agent-bubble-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
}

.agent-bubble-row.left {
  justify-content: flex-start;
}

.agent-bubble-row.right {
  justify-content: flex-end;
}

.agent-msg-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3b82f6;
  display: inline-block;
  flex-shrink: 0;
  margin-right: 2px;
}

.agent-bubble-customer {
  display: inline-block !important;
  width: fit-content !important;
  max-width: 100% !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 5px !important;
  padding: 6px 11px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  box-sizing: border-box;
  color: #0f172a !important;
  word-break: break-word;
}

.agent-bubble-customer .translated-text {
  font-size: 13.5px !important;
  font-weight: 500 !important;
  color: #0f172a !important;
  line-height: 1.35 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.agent-bubble-customer .original-text {
  font-size: 11px !important;
  color: #64748b !important;
  border: none !important;
  border-top: 1px dashed rgba(203, 213, 225, 0.8) !important;
  background: transparent !important;
  padding: 2px 0 0 0 !important;
  margin-top: 2px !important;
  line-height: 1.35 !important;
  display: block !important;
  width: 100% !important;
  white-space: normal !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

.agent-bubble-customer .orig-lang-tag {
  display: none !important;
}

.agent-bubble-customer .orig-text {
  display: inline !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  white-space: pre-wrap !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* Nút sao chép tin nhắn gốc của khách */
.btn-copy-orig-text {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle !important;
  width: 19px !important;
  height: 19px !important;
  min-width: 19px !important;
  min-height: 19px !important;
  padding: 0 !important;
  margin: 0 4px !important;
  background: rgba(241, 245, 249, 0.95) !important;
  border: 1px solid rgba(203, 213, 225, 0.9) !important;
  border-radius: 4px !important;
  color: #64748b !important;
  cursor: pointer !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  transition: all 0.15s ease !important;
  line-height: 1 !important;
}

.btn-copy-orig-text:hover {
  background: #e0e7ff !important;
  color: #4338ca !important;
  border-color: #a5b4fc !important;
  transform: scale(1.1);
}

.btn-copy-orig-text:active {
  transform: scale(0.95);
}

.btn-copy-orig-text.copied {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-color: #86efac !important;
}

.btn-copy-orig-text svg,
.btn-copy-msg-text svg {
  pointer-events: none !important;
}

.agent-msg-actions-hover .btn-copy-msg-text {
  background: #f8fafc !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  height: 28px !important;
  min-width: 28px !important;
  padding: 0 7px !important;
  font-size: 13px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.15s ease !important;
}

.agent-msg-actions-hover .btn-copy-msg-text:hover {
  background: #e0e7ff !important;
  color: #4338ca !important;
  border-color: #a5b4fc !important;
  transform: scale(1.08);
}

.agent-msg-actions-hover .btn-copy-msg-text.copied {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-color: #86efac !important;
}

.agent-bubble-me {
  display: inline-block !important;
  width: fit-content !important;
  max-width: 85% !important;
  background: #eef4ff !important;
  border: 1px solid #c7d2fe !important;
  border-radius: 6px !important;
  padding: 5px 9px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  box-sizing: border-box;
  color: #0f172a !important;
  word-break: break-word;
}

.agent-bubble-me.is-bot {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

.agent-bubble-me .sent-text {
  font-size: 13.5px !important;
  font-weight: 500 !important;
  color: #0f172a !important;
  line-height: 1.35 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.agent-bubble-me.is-bot .sent-text {
  color: #1e3a8a !important;
}

.agent-bubble-me .translated-sent {
  font-size: 11px !important;
  color: #2563eb !important;
  border: none !important;
  border-top: 1px dashed rgba(199, 210, 254, 0.8) !important;
  background: transparent !important;
  padding: 2px 0 0 0 !important;
  margin-top: 2px !important;
  opacity: 1 !important;
  font-weight: 500;
  line-height: 1.25 !important;
  display: flex !important;
  align-items: baseline !important;
  gap: 3px !important;
  width: fit-content !important;
  max-width: 100% !important;
  white-space: normal !important;
}

.agent-bubble-me.is-bot .translated-sent {
  border-top-color: #cbd5e1 !important;
  color: #475569 !important;
}

.agent-bubble-me .trans-lang-tag {
  font-size: 10px !important;
  font-weight: 600 !important;
  opacity: 0.75 !important;
  white-space: nowrap !important;
}

.agent-bubble-me .trans-text {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

.agent-msg-actions-hover {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.88;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.agent-bubble-container:hover .agent-msg-actions-hover,
.agent-msg-row:hover .agent-msg-actions-hover {
  opacity: 1;
}

/* Nút Thu hồi tin nhắn & Bong bóng tin nhắn đã thu hồi */
.agent-msg-row-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  position: relative;
}

.btn-recall-msg {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
  border-radius: 6px;
  height: 28px;
  min-width: 28px;
  padding: 0 7px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  user-select: none;
  box-shadow: 0 1px 3px rgba(225, 29, 72, 0.12), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-recall-msg:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
  transform: translateY(-1px) scale(1.08);
  box-shadow: 0 3px 6px rgba(220, 38, 38, 0.22);
}

.agent-bubble-recalled {
  background: #f1f5f9;
  color: #64748b;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-style: italic;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 90%;
  align-self: flex-end;
}

.msg-bubble.recalled-bubble {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px dashed #cbd5e1 !important;
  font-style: italic !important;
  opacity: 0.85;
}

/* Nút Trả Lời Tin Nhắn (Reply) & Thanh Trích Dẫn */
.agent-customer-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  padding-left: 4px;
}

.btn-reply-msg {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  height: 28px;
  min-width: 28px;
  padding: 0 7px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.14), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-reply-msg:hover {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #60a5fa;
  transform: translateY(-1px) scale(1.08);
  box-shadow: 0 3px 6px rgba(37, 99, 235, 0.25);
}

.btn-copy-img-msg {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #7dd3fc;
  border-radius: 6px;
  height: 28px;
  min-width: 28px;
  padding: 0 7px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.14), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-copy-img-msg:hover {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #38bdf8;
  transform: translateY(-1px) scale(1.08);
  box-shadow: 0 3px 6px rgba(2, 132, 199, 0.25);
}

.btn-copy-img-msg.copied {
  background: #dcfce7 !important;
  color: #15803d !important;
  border-color: #4ade80 !important;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25) !important;
}

.btn-ocr-extract {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #c4b5fd;
  border-radius: 6px;
  height: 28px;
  min-width: 28px;
  padding: 0 7px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow: 0 1px 3px rgba(124, 58, 237, 0.14), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-ocr-extract:hover {
  background: #ede9fe;
  color: #6d28d9;
  border-color: #a78bfa;
  transform: translateY(-1px) scale(1.08);
  box-shadow: 0 3px 6px rgba(124, 58, 237, 0.25);
}

.btn-ocr-extract.loading {
  opacity: 0.7;
  cursor: wait;
  pointer-events: none;
}

.btn-modal-action {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-modal-action:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
}

.btn-modal-action.copied {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #34d399 !important;
}

.reply-quote-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f0fdf4;
  border-left: 4px solid #059669;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 13px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  animation: slideDown 0.18s ease-in-out;
}

.reply-quote-content {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  flex: 1;
}

.reply-quote-icon {
  font-size: 14px;
  color: #059669;
}

.reply-quote-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.reply-quote-author {
  font-weight: 600;
  color: #065f46;
  font-size: 12px;
}

.reply-quote-snippet {
  color: #334155;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 500px;
}

.btn-cancel-reply {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.15s ease;
}

.btn-cancel-reply:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Thẻ trích dẫn trong bong bóng tin nhắn */
.msg-quote-card {
  background: rgba(0, 0, 0, 0.04);
  border-left: 3px solid #3b82f6;
  border-radius: 6px;
  padding: 4px 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-quote-card {
  background: #f1f5f9;
  border-left: 3px solid #059669;
  border-radius: 6px;
  padding: 4px 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Khung xem trước ảnh dán từ clipboard (Pasted Image Preview Bar) */
.pasted-image-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f0fdf4;
  border: 1.5px solid #10b981;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.12);
  animation: slideDown 0.18s ease-in-out;
  gap: 12px;
}

.pasted-img-thumb-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  overflow: hidden;
}

.pasted-img-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #a7f3d0;
  cursor: pointer;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  background: #fff;
}

.pasted-img-thumb:hover {
  transform: scale(1.05);
}

.pasted-img-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.pasted-img-title {
  font-size: 13px;
  color: #065f46;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pasted-img-size {
  font-size: 11px;
  color: #059669;
}

.pasted-img-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-send-pasted-img {
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.25);
  transition: all 0.15s ease;
}

.btn-send-pasted-img:hover {
  background: #047857;
  transform: translateY(-1px);
}

.btn-cancel-pasted-img {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 14px;
  cursor: pointer;
  padding: 5px 9px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.15s ease;
}

.btn-cancel-pasted-img:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* Khung soạn thảo của nhân viên CSKH */
.agent-composer {
  border-top: 1px solid var(--border);
  background: white;
  padding: 6px 14px 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-reply-bar {
  display: none !important;
}

.quick-reply-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.quick-reply-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.compose-box-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.agent-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13.5px;
  height: 48px;
  min-height: 44px;
  resize: vertical;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.agent-textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* Thanh dịch và hiển thị thời gian thực nội dung khách hàng đang gõ (Update #121) */
.customer-live-typing-row {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0 2px 0;
  box-shadow: 0 1px 2px rgba(34, 197, 94, 0.06);
  transition: all 0.2s ease;
  animation: fadeInLiveTyping 0.2s ease-out;
}

@keyframes fadeInLiveTyping {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.live-typing-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #15803d;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.typing-pulse-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.typing-pulse-dots .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #16a34a;
  animation: pulseLiveDot 1.4s infinite ease-in-out both;
}

.typing-pulse-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-pulse-dots .dot:nth-child(2) { animation-delay: -0.16s; }
.typing-pulse-dots .dot:nth-child(3) { animation-delay: 0s; }

@keyframes pulseLiveDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.15); opacity: 1; }
}

.live-typing-body {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-typing-translated {
  font-weight: 600;
  color: #0f172a;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-typing-raw {
  font-size: 11px;
  color: #64748b;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#btnTranslateNow {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #2563eb;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}
#btnTranslateNow:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.btn-agent-export-excel {
  background: #059669;
  color: #ffffff;
  border: none;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}
.btn-agent-export-excel:hover {
  background: #047857;
}

.compose-action-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.lbl-send-lang {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
}

.target-lang-select {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #1e293b;
  cursor: pointer;
  outline: none;
}

.target-lang-select:focus {
  border-color: #3b82f6;
}

.agent-send-actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
}

.btn-send-agent {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0 20px;
  height: 40px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s;
}

.btn-send-agent:hover {
  background: #1d4ed8;
}

/* ==================== ĐÍNH KÈM HÌNH ẢNH & TỆP TIN ==================== */
.attach-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attach-btn:hover {
  background: #e2e8f0;
  transform: scale(1.1);
}

.chat-img-box {
  margin-top: 4px;
}

.chat-msg-img {
  max-width: 320px;
  max-height: 280px;
  width: auto;
  height: auto;
  border-radius: 8px;
  cursor: pointer;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  box-shadow: 0 2px 8px rgba(0,0,0,0.14);
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
  background: rgba(15, 23, 42, 0.05);
}

.chat-msg-img:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(0,0,0,0.22);
}

.chat-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  margin-top: 4px;
}

.chat-file-card .file-icon {
  font-size: 24px;
}

.chat-file-card .file-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-file-card .file-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.chat-file-card .file-size {
  font-size: 11px;
  color: #64748b;
}

.chat-file-card .file-download-btn {
  background: #059669;
  color: white;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal xem ảnh lớn */
.img-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.85);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-content {
  max-width: 92vw;
  max-height: 85vh;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 36px;
  font-weight: bold;
  cursor: pointer;
}

/* ==================== TAB ĐIỀU HƯỚNG NHÂN VIÊN (AGENT TABS) ==================== */
.agent-nav-tabs {
  display: flex;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.agent-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.agent-tab-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.agent-tab-btn.active {
  color: #60a5fa;
  border-bottom-color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
}

/* Giao diện Thống kê (Analytics) */
.stats-container {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
  background: #f8fafc;
}

.stats-header {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats-header h2 {
  font-size: 20px;
  color: #0f172a;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-info h4 {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 4px;
}

.stat-info .stat-number {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
}

/* Giao diện Cài đặt lời chào (Greeting Settings) */
.settings-container {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
  background: #f8fafc;
  max-width: 100%;
}

.settings-layout-wrapper {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
  flex-wrap: wrap;
}

.settings-main-column {
  flex: 1 1 540px;
  min-width: 480px;
  max-width: 880px;
}

/* Cột điều khiển phân quyền nhân viên bên phải (Right Sticky Permission Panel) */
.settings-perm-sidebar {
  width: 340px;
  flex-shrink: 0;
  position: sticky;
  top: 0px;
  z-index: 20;
}

.perm-sidebar-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.perm-sidebar-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 14px;
}

.perm-sidebar-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.perm-sidebar-shield {
  font-size: 24px;
  line-height: 1;
}

.perm-sidebar-title-box {
  flex: 1;
}

.perm-sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
}

.perm-sidebar-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: #fef3c7;
  color: #b45309;
  border-radius: 12px;
  display: inline-block;
  margin-top: 3px;
  border: 1px solid #fde68a;
}

.perm-sidebar-guide {
  font-size: 11.5px;
  line-height: 1.55;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0 12px 0;
}

.perm-sidebar-guide strong {
  color: #0f172a;
}

.perm-sidebar-guide .txt-green {
  color: #059669;
  font-weight: 700;
}

.perm-sidebar-guide .txt-red {
  color: #dc2626;
  font-weight: 700;
}

.perm-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-perm-action {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid transparent;
}

.btn-perm-all-on {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.btn-perm-all-on:hover {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.btn-perm-all-off {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.btn-perm-all-off:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.perm-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.perm-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.perm-row-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}

.perm-row-item.active {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25) !important;
}

@keyframes branchFadeIn {
  from {
    opacity: 0.1;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-card,
.stats-grid,
.traffic-chart-card,
.table-card {
  animation: branchFadeIn 0.2s ease-out;
}

.perm-row-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.perm-row-icon {
  font-size: 19px;
  flex-shrink: 0;
  line-height: 1;
}

.perm-row-text {
  min-width: 0;
}

.perm-row-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.perm-row-desc {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.2;
}

.perm-row-control {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  margin-left: 8px;
}

.perm-badge-status {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
  line-height: 1.2;
  transition: all 0.2s ease;
}

.badge-on {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-off {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.perm-sidebar-footer {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

/* Header Permission Controls on Cards */
.card-perm-header-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 5px 12px;
  border-radius: 20px;
  transition: all 0.2s ease;
}

.card-perm-header-box .perm-title-lbl {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
}

.perm-state-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.perm-tag-on {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.perm-tag-off {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Banner Alert on Cards */
.card-perm-banner {
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 16px;
  animation: fadeInBanner 0.25s ease;
}

@keyframes fadeInBanner {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-perm-banner.banner-locked {
  background: #fff1f2;
  border: 1.5px solid #fecdd3;
  color: #be123c;
}

.card-perm-banner.banner-custom {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  color: #15803d;
}

.card-perm-banner .perm-banner-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* Locked Card States for Agents */
.card-is-locked input:not(.chk-exempt),
.card-is-locked textarea:not(.chk-exempt),
.card-is-locked select:not(.chk-exempt) {
  background-color: #f8fafc !important;
  color: #64748b !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.card-is-locked button.btn-save-settings,
.card-is-locked button.btn-save-action-buttons,
.card-is-locked button.btn-filter {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  filter: grayscale(0.5);
}

/* Toggle Switches */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 20px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #10b981;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

.toggle-switch-sm {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
}

.toggle-switch-sm input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider-sm {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 18px;
}

.toggle-slider-sm:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.toggle-switch-sm input:checked + .toggle-slider-sm {
  background-color: #10b981;
}

.toggle-switch-sm input:checked + .toggle-slider-sm:before {
  transform: translateX(14px);
}


.settings-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-group label {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.setting-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  resize: vertical;
  min-height: 80px;
}

.setting-textarea:focus {
  border-color: #059669;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15);
}

.btn-save-settings {
  background: #059669;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.2s;
}

.btn-save-settings:hover {
  background: #047857;
}

/* ==================== BỘ LỌC NGÀY GIỜ & XUẤT EXCEL ==================== */
.date-filter-card {
  background: rgba(255, 255, 255, 0.98);
  /* GPU-light: backdrop-filter removed for low-spec PCs (Update #182) */
  border-radius: 12px;
  padding: 16px 20px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 60;
}

.traffic-chart-card, .table-card, .stats-grid {
  scroll-margin-top: 140px;
}

/* Mini Time Bar inside each section (Update #79) */
.section-time-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
}

.mini-preset-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-mini-chip {
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: white;
  color: #475569;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-mini-chip:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}

.btn-mini-chip.active {
  background: #2563eb;
  border-color: #1d4ed8;
  color: white;
  font-weight: 700;
}

.badge-time-range {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.date-inputs-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.date-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-input-group label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

.date-input-field {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  color: #0f172a;
  background: #f8fafc;
}

.date-input-field:focus {
  border-color: #059669;
  background: white;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.btn-filter {
  background: #059669;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.btn-filter:hover {
  background: #047857;
}

.btn-excel {
  background: #10b981;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.btn-excel:hover {
  background: #059669;
}

.preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-chip {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.preset-chip:hover {
  background: #ecfdf5;
  border-color: #059669;
  color: #059669;
}

.preset-chip.active {
  background: #059669 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.3);
}

/* Bảng hiệu suất nhân viên & Bảng quản lý tài khoản */
.table-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-top: 20px;
}

.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.table-card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.custom-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 2px solid #e2e8f0;
}

.custom-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.custom-table tr:hover td {
  background: #f8fafc;
}

.badge-role {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}

.badge-role-admin {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-role-agent {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* ==================== ĐĂNG NHẬP & PHÂN QUYỀN ==================== */
.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  padding: 8px 16px;
  border-bottom: 1px solid #1e293b;
  color: white;
  font-size: 12px;
}

.user-info-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-logout {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.4);
}

.login-overlay {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8);
  /* GPU-light: backdrop-filter removed for low-spec PCs (Update #182) */
  align-items: center;
  justify-content: center;
}

.login-box {
  background: white;
  border-radius: 16px;
  width: 380px;
  padding: 32px 28px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-header {
  text-align: center;
}

.login-header h2 {
  font-size: 20px;
  color: #0f172a;
  margin-bottom: 6px;
}

.login-header p {
  font-size: 13px;
  color: #64748b;
}

.login-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.login-input {
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

.login-input:focus {
  border-color: #059669;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15);
}

.btn-login-submit {
  background: #059669;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 4px;
}

.btn-login-submit:hover {
  background: #047857;
}

.quick-login-hints {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.6;
}

.empty-chat-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
  gap: 12px;
}

.empty-chat-state svg {
  width: 64px;
  height: 64px;
  stroke: #cbd5e1;
}

/* ==================== AVATAR, PROFILE & UNANSWERED STYLES ==================== */
.agent-profile-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.agent-profile-bar:hover {
  background: rgba(255, 255, 255, 0.14);
}
.profile-avatar-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}
.my-avatar-img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #10b981;
  background: #ffffff;
}
.avatar-edit-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #0f172a;
  border-radius: 50%;
  font-size: 10px;
  padding: 1px 2px;
  border: 1px solid rgba(255,255,255,0.2);
}
.profile-info-wrap {
  flex: 1;
  min-width: 0;
}
.my-nickname-txt {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.my-role-txt {
  font-size: 11px;
  color: #94a3b8;
}
.btn-logout-icon {
  background: transparent;
  border: none;
  color: #f87171;
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
}
.btn-logout-icon:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
}

/* Update #116: Thanh lọc hội thoại đồng nghiệp theo từng nhân sự */
.sidebar-colleague-filter-row {
  padding: 4px 10px 8px 10px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
}
.colleague-filter-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  transition: all 0.2s ease;
}
.colleague-filter-inner:hover {
  border-color: #94a3b8;
  background: #ffffff;
}
.colleague-filter-inner:focus-within {
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.colleague-filter-icon {
  font-size: 13px;
  color: #64748b;
  flex-shrink: 0;
  line-height: 1;
}
.colleague-filter-select {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.colleague-filter-select option {
  font-size: 12px;
  color: #1e293b;
  padding: 4px;
}

/* Bộ lọc danh sách khách hàng */
.conv-filter-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}
.conv-filter-chip {
  flex: 1;
  padding: 6px 4px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-filter-chip:hover {
  background: #f8fafc;
}
.conv-filter-chip.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
.conv-filter-chip.chip-unanswered.active {
  background: #475569;
  color: #ffffff;
  border-color: #334155;
}
.conv-filter-chip.chip-closed.active {
  background: #64748b;
  color: #ffffff;
  border-color: #475569;
}
.badge-status-unanswered {
  background: #fee2e2;
  color: #991b1b;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #fecaca;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* Avatar picker trong modal */
.avatar-picker-grid {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}
.avatar-pick-option {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
  background: #ffffff;
}
.avatar-pick-option:hover {
  transform: scale(1.12);
}
.avatar-pick-option.selected {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.3);
}
.table-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

/* Header tin nhắn của nhân viên CSKH khi chat */
.agent-chat-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.agent-chat-msg-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: #ffffff;
  border: 1px solid #10b981;
}
.agent-chat-msg-name {
  font-size: 11px;
  font-weight: 700;
  color: #047857;
}

.welcome-img-preview-box {
  margin-top: 8px;
  padding: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}

/* Nút bấm chuyển chế độ Ẩn thân / Nhận khách */
.btn-stealth-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  user-select: none;
  margin-left: auto;
  margin-right: 4px;
}
.btn-stealth-pill.online {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.btn-stealth-pill.online:hover {
  background: rgba(16, 185, 129, 0.35);
}
.btn-stealth-pill.stealth {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.btn-stealth-pill.stealth:hover {
  background: rgba(245, 158, 11, 0.35);
}
.stealth-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.btn-stealth-pill.online .stealth-dot {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}
.btn-stealth-pill.stealth .stealth-dot {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

/* Bong bóng và thời gian chờ của khách đang đợi trả lời */
.conv-item.is-unanswered-card {
  border-left: 3px solid #f87171 !important;
  background: #ffffff;
}
.conv-item.is-unanswered-card:hover {
  background: #f8fafc;
}
.conv-item.is-unanswered-card.active {
  background: #f0f6ff !important;
  border-left: 3px solid #3b82f6 !important;
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.08);
}

.wait-alert-badge-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}
.badge-unanswered-count {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  box-shadow: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge-wait-timer {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 8px;
  white-space: nowrap;
}

/* Thanh chuyển phạm vi phụ trách: Khách của tôi vs Nhân viên khác */
.filter-staff-toggle-row {
  display: flex;
  gap: 6px;
  padding: 8px 12px 4px 12px;
}
.btn-staff-scope {
  flex: 1;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s;
}
.btn-staff-scope:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.btn-staff-scope.active {
  background: #334155;
  color: #ffffff;
  border-color: #1e293b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.btn-staff-scope.btn-scope-others.active {
  background: #475569;
  color: #ffffff;
  border-color: #334155;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.badge-other-agent {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Banner thông báo khi đang xem/hỗ trợ cuộc trò chuyện của nhân viên khác */
.other-staff-banner {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #3b82f6;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 16px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.other-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.other-banner-icon {
  font-size: 22px;
}
.other-banner-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 2px;
}
.other-banner-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}
.btn-takeover {
  background: #2563eb;
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}
.btn-takeover:hover {
  background: #1d4ed8;
}

/* 2 Nút chuyển đổi chế độ ở thanh soạn tin: Trả lời khách vs Ghi chú nội bộ */
.composer-mode-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px 0;
  padding: 0;
}
.btn-composer-mode {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  line-height: 1;
  transition: all 0.15s;
}
.btn-composer-mode:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.btn-composer-mode.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.1);
}
.btn-composer-mode.btn-mode-internal.active {
  background: #f8fafc;
  color: #475569;
  border-color: #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.mode-tag-pill {
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}
.mode-tag-public {
  background: #eff6ff;
  color: #1d4ed8;
}
.mode-tag-internal {
  background: #fee2e2;
  color: #991b1b;
  font-weight: 600;
}

/* Chế độ Ghi chú nội bộ áp dụng lên ô soạn thảo */
.compose-box-wrapper.is-internal-mode .agent-textarea {
  background: #fdfaf8 !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.15) !important;
}
.btn-send-agent.btn-send-internal {
  background: #475569 !important;
  color: #ffffff !important;
  border-color: #334155 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}
.btn-send-agent.btn-send-internal:hover {
  background: #334155 !important;
}

/* Update #110: Chế độ Đồng nghiệp trả lời hộ (Assist Reply Mode) */
.btn-composer-mode.btn-mode-assist.active {
  background: #e0f2fe !important;
  color: #0284c7 !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.15) !important;
}
.mode-tag-assist {
  background: #bae6fd !important;
  color: #0369a1 !important;
  font-weight: 600;
}
.compose-box-wrapper.is-assist-mode .agent-textarea {
  background: #f0f9ff !important;
  border-color: #38bdf8 !important;
  color: #0c4a6e !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2) !important;
}
.btn-send-agent.btn-send-assist {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0369a1 !important;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.3) !important;
}
.btn-send-agent.btn-send-assist:hover {
  background: #0369a1 !important;
}

/* Bong bóng tin nhắn Đồng nghiệp trả lời hộ (Nền xanh lam - Blue Background) */
.agent-bubble-me.is-assist-reply {
  background: #0284c7 !important;
  color: #ffffff !important;
  border: 1px solid #0369a1 !important;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.25) !important;
}
.agent-bubble-me.is-assist-reply .sent-text {
  color: #ffffff !important;
  font-weight: 500;
}
.agent-bubble-me.is-assist-reply .translated-sent {
  border-top: 1px dashed rgba(255, 255, 255, 0.35) !important;
  color: #e0f2fe !important;
}
.agent-bubble-me.is-assist-reply .trans-lang-tag {
  color: #bae6fd !important;
}
.agent-bubble-me.is-assist-reply .trans-text {
  color: #ffffff !important;
}
.agent-bubble-me.is-assist-reply .chat-text-link {
  color: #fef08a !important;
  text-decoration-color: #fef08a !important;
}
.bubble-assist-name {
  color: #0284c7 !important;
  font-weight: 700 !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Thông báo sự kiện hệ thống (Tiếp quản, chuyển giao, bàn giao...) - Chỉ 1 dòng chữ, không cần khung, tiết kiệm diện tích */
.agent-system-notice-wrap {
  align-self: center;
  width: 100%;
  text-align: center;
  margin: 4px 0;
}
.agent-system-notice-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 2px 10px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
  text-align: center;
  max-width: 95%;
  user-select: text;
}
.agent-system-notice-line .notice-text {
  color: #64748b;
  font-weight: 500;
}
.agent-system-notice-line .notice-time {
  font-size: 11px;
  color: #94a3b8;
  margin-left: 2px;
}

/* Ghi chú nội bộ hiển thị bên phải, màu đỏ nổi bật (Staff internal note) */
.agent-bubble-internal-note {
  background: #fff1f2 !important; /* Gam màu hồng đỏ nhẹ nhàng, thanh lịch, nổi bật */
  border: 1px solid #fecdd3 !important; /* Viền đỏ nhạt tinh tế */
  border-left: 3px solid #ef4444 !important; /* Viền đỏ tươi nổi bật bên trái */
  border-radius: 6px !important;
  padding: 5px 10px !important;
  color: #881337 !important;
  font-size: 13px !important;
  box-shadow: 0 1px 2px rgba(225, 29, 72, 0.08) !important;
  box-sizing: border-box;
  display: inline-block !important;
  width: fit-content !important;
  max-width: 100% !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  margin: 1px 0 !important;
}

.agent-bubble-internal-note .internal-note-text {
  font-weight: 500;
  color: #4c0519 !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  line-height: 1.4 !important;
  font-size: 13px !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Nút bấm xem cuộc chưa trả lời trong bảng hiệu suất */
.btn-unanswered-pill {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.btn-unanswered-pill:hover {
  background: #fecaca;
  transform: scale(1.05);
}
.btn-unanswered-pill.is-restricted {
  background: #f1f5f9 !important;
  color: #94a3b8 !important;
  border: 1px dashed #cbd5e1 !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}
.btn-unanswered-pill.is-restricted:hover {
  background: #f1f5f9 !important;
  transform: none !important;
}
.badge-zero-unanswered {
  color: #94a3b8;
  font-weight: 500;
  font-size: 12px;
}

/* Trình phát Video trực tiếp trong bong bóng chat */
.chat-msg-video {
  max-width: 100%;
  width: 320px;
  max-height: 240px;
  border-radius: 8px;
  outline: none;
  background: #000;
  display: block;
  margin-top: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.chat-video-box {
  margin-top: 6px;
  border-radius: 8px;
  overflow: hidden;
  background: #0f172a;
}

/* Thanh thông tin video & nút tải xuống / mở ngoài */
.video-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: rgba(15, 23, 42, 0.85);
  /* GPU-light: backdrop-filter removed for low-spec PCs (Update #182) */
  color: #94a3b8;
  font-size: 11px;
  gap: 8px;
}
.video-size-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.video-dl-btn {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.15);
  transition: all 0.15s ease;
}
.video-dl-btn:hover {
  background: rgba(56, 189, 248, 0.3);
  color: #fff;
}

/* Thẻ hiển thị tiến trình tải video/tệp lên (Customer & Agent) */
.upload-progress-card {
  position: absolute;
  bottom: 66px;
  left: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.96);
  /* GPU-light: backdrop-filter removed for low-spec PCs (Update #182) */
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.upload-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
}
.upload-progress-icon {
  font-size: 16px;
}
.upload-progress-name {
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.upload-progress-percent {
  color: #38bdf8;
  font-weight: 700;
  font-size: 13px;
}
.upload-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #06b6d4);
  border-radius: 3px;
  transition: width 0.15s ease-out;
}
.upload-progress-status {
  font-size: 11px;
  color: #94a3b8;
  text-align: right;
}
.drag-over-active {
  outline: 2px dashed #0284c7 !important;
  outline-offset: -4px;
  background-color: rgba(2, 132, 199, 0.05) !important;
}

/* ==================== BẢNG TIỆN ÍCH BÊN PHẢI (HỒ SƠ KHÁCH HÀNG & MÁY TÍNH BỎ TÚI) ==================== */
.agent-right-panel {
  width: 330px;
  min-width: 330px;
  max-width: 330px;
  background: #ffffff;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.03);
  z-index: 20;
  transition: all 0.25s ease-in-out;
}

.right-panel-header {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.right-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #0f172a;
}

.btn-close-right-panel {
  background: none;
  border: none;
  font-size: 16px;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.btn-close-right-panel:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.right-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
}

/* Thẻ thông tin khách */
.panel-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.panel-card-header h4 {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-rename-pill {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-rename-pill:hover {
  background: #dbeafe;
}

.cust-name-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
}
.cust-avatar-circle {
  font-size: 20px;
}
.cust-name-text {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.cust-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 14px;
}
.cust-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}
.meta-label {
  color: #64748b;
  font-weight: 500;
}
.meta-val {
  color: #0f172a;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-copy-code {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  font-size: 12px;
}

/* Ghi chú khách */
.cust-notes-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed #e2e8f0;
}
.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notes-header label {
  font-size: 12px;
  color: #334155;
  font-weight: 600;
}
.btn-save-notes {
  background: #2563eb;
  color: white;
  border: none;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-save-notes:hover {
  background: #1d4ed8;
}
.notes-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  min-height: 70px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.notes-textarea:focus {
  border-color: #2563eb;
}
.notes-save-status {
  font-size: 11px;
  color: #2563eb;
  font-weight: 600;
  text-align: right;
}

/* Máy tính bỏ túi */
.calc-badge-subtitle {
  font-size: 10px;
  color: #64748b;
  font-weight: 500;
}
.calculator-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.calc-screen {
  background: #0f172a;
  border-radius: 10px;
  padding: 10px 14px;
  text-align: right;
  color: #ffffff;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}
.calc-history {
  font-size: 11px;
  color: #94a3b8;
  min-height: 16px;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calc-current {
  font-size: 24px;
  font-weight: 700;
  font-family: monospace;
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calc-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.calc-btn {
  height: 38px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  user-select: none;
}
.calc-btn:active {
  transform: scale(0.95);
}
.calc-btn.btn-num {
  background: #ffffff;
  color: #0f172a;
}
.calc-btn.btn-num:hover {
  background: #f1f5f9;
}
.calc-btn.btn-op {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
  font-weight: 700;
}
.calc-btn.btn-op:hover {
  background: #dbeafe;
}
.calc-btn.btn-func {
  background: #f8fafc;
  color: #475569;
}
.calc-btn.btn-func:hover {
  background: #f1f5f9;
}
.calc-btn.btn-equal {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}
.calc-btn.btn-equal:hover {
  background: #1d4ed8;
}

.calc-action-bar {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.btn-calc-insert {
  flex: 1;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.btn-calc-insert:hover {
  background: #dbeafe;
  transform: translateY(-1px);
}
.btn-calc-copy {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-calc-copy:hover {
  background: #f1f5f9;
}

/* Huy hiệu trạng thái đã đóng */
.badge-closed {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

/* Banner lịch sử tin nhắn cuộn lên */
#historyTopBanner {
  width: 100%;
  text-align: center;
  padding: 8px 0;
  margin-bottom: 8px;
  position: sticky;
  top: 0;
  z-index: 10;
  pointer-events: auto;
}

.history-banner-scrollable span {
  transition: all 0.2s ease;
}

.history-banner-scrollable span:hover {
  background: #bae6fd !important;
  color: #0369a1 !important;
  transform: translateY(-1px);
}

/* ==================== ĐỒNG HỒ THỜI GIAN THỰC TẾ & BẢNG MÚI GIỜ TRÊN TOPBAR ==================== */
.topbar-clock-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  user-select: none;
}

/* NÚT CHỌN NGÔN NGỮ HỆ THỐNG TRÊN THANH TOPBAR (UPDATE #87) */
.topbar-sys-lang-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  user-select: none;
}

.topbar-sys-lang-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 5px 13px;
  border-radius: 20px;
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.topbar-sys-lang-badge:hover, .topbar-sys-lang-badge.active {
  background: rgba(51, 65, 85, 0.98);
  border-color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(56, 189, 248, 0.3);
}

.topbar-sys-lang-icon {
  font-size: 14px;
}

.topbar-sys-lang-flag {
  font-size: 13.5px;
}

.topbar-sys-lang-text {
  font-size: 12.5px;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: 0.2px;
}

.topbar-sys-lang-caret {
  font-size: 10px;
  color: #94a3b8;
  margin-left: 2px;
  transition: transform 0.2s ease;
}

.topbar-sys-lang-badge.active .topbar-sys-lang-caret {
  transform: rotate(180deg);
}

.topbar-clock-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 5px 14px;
  border-radius: 20px;
  color: #f8fafc;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.topbar-clock-badge:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.2);
}

.clock-live-dot {
  color: #10b981;
  font-size: 10px;
  animation: pulse-live 1.5s infinite;
}

@keyframes pulse-live {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

.clock-icon {
  font-size: 13px;
}

.clock-flag {
  font-size: 15px;
  line-height: 1;
}

.clock-country {
  font-weight: 600;
  color: #e2e8f0;
}

.clock-offset {
  font-size: 10px;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.6);
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.clock-divider {
  color: rgba(148, 163, 184, 0.3);
  font-weight: 300;
}

.clock-time {
  font-family: 'Inter', monospace;
  font-size: 14px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

.clock-date {
  font-size: 11px;
  color: #94a3b8;
}

.clock-arrow {
  font-size: 9px;
  color: #94a3b8;
  margin-left: 2px;
  transition: transform 0.2s;
}

.topbar-clock-badge:hover .clock-arrow {
  color: #38bdf8;
}

/* Dropdown menu chọn múi giờ */
.tz-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 380px;
  max-width: 90vw;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  overflow: hidden;
  animation: fadeInDown 0.15s ease-out;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.tz-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #0f172a;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.tz-header-title {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
}

.tz-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}
.tz-close-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.1);
}

.tz-search-wrap {
  padding: 10px 12px 6px 12px;
  background: #1e293b;
}

.tz-search-input {
  width: 100%;
  padding: 7px 12px;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  color: #f8fafc;
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
}

.tz-search-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.tz-list-container {
  max-height: 290px;
  overflow-y: auto;
  padding: 4px 6px 8px 6px;
}

.tz-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin: 2px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #cbd5e1;
}

.tz-item:hover {
  background: rgba(56, 189, 248, 0.12);
  color: #f8fafc;
}

.tz-item.active {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.tz-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tz-item-flag {
  font-size: 18px;
}

.tz-item-name {
  font-weight: 600;
  font-size: 12px;
}

.tz-item-cities {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.tz-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.tz-item-live-time {
  font-family: 'Inter', monospace;
  font-weight: 700;
  font-size: 12px;
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
}

.tz-item-offset {
  font-size: 10px;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.6);
  padding: 1px 5px;
  border-radius: 6px;
}

/* ==================== BỘ ĐIỀU KHIỂN ÂM THANH TOÀN CỤC (GLOBAL SOUND CONTROL) ==================== */
.topbar-sound-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 4px 10px;
  border-radius: 20px;
  color: #f8fafc;
  transition: all 0.2s ease;
  user-select: none;
}

.topbar-sound-control:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(56, 189, 248, 0.4);
}

.btn-sound-toggle {
  background: transparent;
  border: none;
  color: #f8fafc;
  font-size: 15px;
  cursor: pointer;
  padding: 2px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: transform 0.15s ease, opacity 0.15s ease;
  line-height: 1;
}

.btn-sound-toggle:hover {
  transform: scale(1.15);
}

.btn-sound-toggle.is-muted {
  opacity: 0.65;
  filter: grayscale(1);
}

.sound-slider-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sound-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 5px;
  border-radius: 5px;
  background: #475569;
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}

.sound-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #38bdf8;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, background 0.2s;
}

.sound-volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: #0ea5e9;
}

.sound-volume-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #38bdf8;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.sound-volume-label {
  font-family: 'Inter', monospace;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  min-width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   SẮP XẾP BẢNG HIỆU SUẤT NHÂN VIÊN (SORT CONTROLS IN TABLE HEADERS)
   ========================================================================== */
.th-sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.th-sortable:hover {
  background-color: #f1f5f9 !important;
}

.th-sort-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.th-sort-buttons {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.btn-th-sort {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 3px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #64748b;
  font-size: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-th-sort:hover {
  border-color: #059669;
  color: #059669;
  background: #ecfdf5;
}

.btn-th-sort.is-active {
  background: #059669 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.4);
}

.table-sort-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 16px;
  font-weight: 500;
}

.btn-reset-sort {
  background: transparent;
  border: none;
  color: #059669;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  transition: color 0.15s ease;
}

.btn-reset-sort:hover {
  color: #047857;
}

.btn-force-logout {
  transition: all 0.2s ease;
}

.btn-force-logout:hover {
  background: #ea580c !important;
  color: #ffffff !important;
  border-color: #c2410c !important;
  box-shadow: 0 2px 4px rgba(234, 88, 12, 0.25);
}

.btn-close-conv {
  transition: all 0.2s ease;
}

.btn-close-conv:hover {
  background: #e11d48 !important;
  color: #ffffff !important;
  border-color: #be123c !important;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.25);
}

.btn-toggle-no-translate {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-toggle-no-translate:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}

.btn-toggle-no-translate.active {
  background: #fff7ed !important;
  color: #ea580c !important;
  border-color: #f97316 !important;
  box-shadow: 0 1px 3px rgba(234, 88, 12, 0.2);
}

.btn-toggle-no-translate.active .no-trans-icon {
  transform: scale(1.15);
}

/* ==================== HỆ THỐNG THÔNG BÁO TOÀN HỆ THỐNG (BROADCAST ANNOUNCEMENT) ==================== */
/* Toast thông báo hệ thống nổi */
.floating-broadcast-toast {
  position: fixed;
  top: 48px;
  right: 24px;
  z-index: 10001;
  background: #ffffff;
  border: 1px solid #fed7aa;
  border-left: 4px solid #f97316;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(249, 115, 22, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 12px 16px;
  max-width: 420px;
  width: calc(100vw - 48px);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  animation: slideInRight 0.3s ease-out;
  transition: transform 0.2s, box-shadow 0.2s;
}
.floating-broadcast-toast:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -5px rgba(249, 115, 22, 0.35);
}
.floating-broadcast-toast.urgent {
  border-color: #fca5a5;
  border-left-color: #ef4444;
  box-shadow: 0 10px 25px -5px rgba(239, 68, 68, 0.3);
}
.toast-icon-wrap {
  font-size: 24px;
  line-height: 1;
}
.toast-content-wrap {
  flex: 1;
  min-width: 0;
}
.toast-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.toast-level-tag {
  font-size: 11px;
  font-weight: 700;
  color: #c2410c;
  background: #ffedd5;
  padding: 1px 6px;
  border-radius: 4px;
}
.floating-broadcast-toast.urgent .toast-level-tag {
  color: #b91c1c;
  background: #fee2e2;
}
.toast-time {
  font-size: 11px;
  color: #94a3b8;
}
.toast-close-btn {
  background: none;
  border: none;
  font-size: 14px;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 4px;
}
.toast-close-btn:hover {
  color: #0f172a;
}
.toast-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
  line-height: 1.3;
}
.toast-body {
  font-size: 12.5px;
  color: #475569;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Modal thông báo */
.announcement-modal-card {
  max-width: 680px;
  width: 92%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.announcement-modal-body {
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.announcement-composer-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 14px;
}
.composer-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.quick-preset-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip-preset {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.chip-preset:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.announce-form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.announce-input-title {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.announce-input-title:focus {
  border-color: #3b82f6;
}
.announce-select-level {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  background: white;
}
.announce-textarea-content {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}
.announce-textarea-content:focus {
  border-color: #3b82f6;
}
.btn-send-announcement {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-send-announcement:hover {
  background: #1d4ed8;
}
.announcement-list-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.announcement-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.btn-refresh-announces {
  background: none;
  border: 1px solid #cbd5e1;
  color: #475569;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}
.btn-refresh-announces:hover {
  background: #f1f5f9;
}
.announcement-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.announcement-card {
  border: 1px solid #e2e8f0;
  border-left: 4px solid #3b82f6;
  border-radius: 8px;
  padding: 12px 14px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.announcement-card.urgent {
  border-left-color: #ef4444;
  background: #fffafa;
}
.announcement-card.warning {
  border-left-color: #f59e0b;
  background: #fffdfa;
}
.announcement-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.announcement-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}
.announcement-card-body {
  font-size: 13px;
  color: #334155;
  line-height: 1.5;
  white-space: pre-wrap;
}
/* Transfer Dropdown Menu & Quick Transfer */
.transfer-dropdown-container {
  position: relative;
  display: inline-block;
}

.transfer-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 290px;
  max-width: 360px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  padding: 6px;
  animation: dropdownFadeIn 0.18s ease-out;
}

.transfer-dropdown-menu.show {
  display: block;
}

.transfer-dropdown-header {
  padding: 8px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 4px;
}

.transfer-dropdown-list {
  max-height: 280px;
  overflow-y: auto;
}

.transfer-agent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.transfer-agent-item:hover {
  background: #eff6ff;
}

.transfer-agent-item:active {
  background: #dbeafe;
  transform: scale(0.99);
}

.transfer-agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid #cbd5e1;
}

.transfer-agent-info {
  flex: 1;
  min-width: 0;
}

.transfer-agent-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transfer-agent-meta {
  font-size: 11px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}

.transfer-agent-badge {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.transfer-agent-badge.badge-green {
  background: #dcfce7;
  color: #15803d;
}

.transfer-agent-badge.badge-amber {
  background: #fef3c7;
  color: #b45309;
}

.transfer-agent-badge.badge-red {
  background: #fee2e2;
  color: #b91c1c;
}

.transfer-dropdown-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 12.5px;
  color: #94a3b8;
}

.btn-quick-transfer {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfdbfe !important;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-quick-transfer:hover {
  background: #dbeafe !important;
  border-color: #93c5fd !important;
  color: #1e40af !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
}

/* ==================== CẬP NHẬT LẦN #43: TỰ ĐỘNG NHẬN DIỆN & ĐỊNH DẠNG LINK BẤM ĐƯỢC TRÊN KHUNG CHAT ==================== */
.agent-bubble-customer .translated-text,
.agent-bubble-customer .orig-text,
.agent-bubble-me .sent-text,
.agent-bubble-me .trans-text,
.internal-note-text,
.chat-msg-text,
.ann-content {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Kiểu dáng cho Hyperlink trong tin nhắn (.chat-text-link) */
.chat-text-link {
  word-break: break-all;
  overflow-wrap: anywhere;
  text-decoration: underline;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  font-weight: 600;
  display: inline;
}

/* Link trong tin nhắn Khách hàng gửi đến (Giao diện Agent - bong bóng nền trắng) */
.agent-bubble-customer .chat-text-link,
.internal-note-text .chat-text-link,
.ann-content .chat-text-link,
.msg-row.agent .msg-bubble .chat-text-link,
.msg-row.bot .msg-bubble .chat-text-link {
  color: #2563eb !important;
  text-decoration: underline !important;
  text-decoration-color: #93c5fd !important;
}
.agent-bubble-customer .chat-text-link:hover,
.internal-note-text .chat-text-link:hover,
.ann-content .chat-text-link:hover,
.msg-row.agent .msg-bubble .chat-text-link:hover,
.msg-row.bot .msg-bubble .chat-text-link:hover {
  color: #1d4ed8 !important;
  text-decoration-color: #1d4ed8 !important;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 4px;
}

/* Link trong tin nhắn Nhân viên gửi đi (Giao diện Agent) */
.agent-bubble-me .chat-text-link {
  color: #2563eb !important;
  text-decoration: underline !important;
  text-decoration-color: #93c5fd !important;
}
.agent-bubble-me .chat-text-link:hover {
  color: #1d4ed8 !important;
  text-decoration-color: #1d4ed8 !important;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 4px;
}

/* Link trong tin nhắn Khách hàng gửi đi (Giao diện Customer) */
.msg-row.customer .msg-bubble .chat-text-link {
  color: #047857 !important;
  text-decoration: underline !important;
  text-decoration-color: #6ee7b7 !important;
}
.msg-row.customer .msg-bubble .chat-text-link:hover {
  color: #065f46 !important;
  text-decoration-color: #065f46 !important;
  background: rgba(5, 150, 105, 0.08);
  border-radius: 4px;
}

/* ==================== CUTE EMOJI & ICON PICKER (BỘ ICON NGỘ NGHĨNH DỄ THƯƠNG) ==================== */
.cute-emoji-popover {
  position: absolute;
  bottom: 60px;
  left: 10px;
  width: 350px;
  max-width: calc(100vw - 20px);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 14px 35px -4px rgba(15, 23, 42, 0.22), 0 6px 14px -2px rgba(15, 23, 42, 0.1);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cutePopoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cutePopoverFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.cute-emoji-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 6px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}

.cute-emoji-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-close-emoji-picker {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.15s;
}

.btn-close-emoji-picker:hover {
  background: #f1f5f9;
  color: #334155;
}

.cute-emoji-nav-tabs {
  display: flex;
  background: #f8fafc;
  padding: 4px 6px;
  gap: 4px;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.cute-emoji-tab {
  background: transparent;
  border: none;
  font-size: 14px;
  padding: 5px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  color: #475569;
  font-weight: 600;
}

.cute-emoji-tab:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.cute-emoji-tab.active {
  background: #e0e7ff;
  color: #4338ca;
  box-shadow: 0 1px 2px rgba(67, 56, 202, 0.15);
}

.cute-emoji-body {
  padding: 8px 10px;
  max-height: 190px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.cute-emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cute-emoji-btn {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  transition: transform 0.12s ease, background 0.12s ease;
  user-select: none;
}

.cute-emoji-btn:hover {
  background: #f1f5f9;
  transform: scale(1.3);
}

.cute-emoji-btn:active {
  transform: scale(0.95);
}

.cute-kaomoji-section {
  border-top: 1px solid #f1f5f9;
  padding: 6px 10px;
  background: #fafafa;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.cute-kaomoji-pill {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 3px 8px;
  font-size: 11px;
  color: #475569;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
  user-select: none;
}

.cute-kaomoji-pill:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0284c7;
  transform: translateY(-1px);
}

/* Update #122: Nút đính kèm icon-only trong Toolbar Nhân Viên (Ảnh/Video, File, Icon Sticker) */
.toolbar-left .attach-btn {
  width: 36px !important;
  height: 36px !important;
  border-radius: 8px !important;
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: #334155 !important;
  padding: 0 !important;
  margin: 0 !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  box-sizing: border-box !important;
}

.toolbar-left .attach-btn:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

.toolbar-left .btn-cute-emoji {
  background: #fdf2f8 !important;
  border: 1px solid #fbcfe8 !important;
  color: #db2777 !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  padding: 0 !important;
  width: 36px !important;
  height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none !important;
  -webkit-user-select: none !important;
  box-sizing: border-box !important;
}

.toolbar-left .btn-cute-emoji:hover {
  background: #fce7f3 !important;
  border-color: #f472b6 !important;
  transform: translateY(-1px) scale(1.06);
  box-shadow: 0 2px 6px rgba(219, 39, 119, 0.18);
}

/* Nút Icon Ngộ Nghĩnh Khách Hàng */
.input-area .btn-cute-emoji {
  background: rgba(244, 63, 94, 0.08) !important;
  border: 1px solid rgba(244, 63, 94, 0.2) !important;
  color: #e11d48 !important;
  font-size: 19px !important;
  border-radius: 50% !important;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.input-area .btn-cute-emoji:hover {
  background: rgba(244, 63, 94, 0.18) !important;
  transform: scale(1.12);
}

/* Bộ chọn ngôn ngữ Giao diện Khách Hàng (Hệ thống UI) */
.cust-ui-lang-wrap {
  display: flex;
  align-items: center;
}

.cust-ui-lang-select {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 14px;
  padding: 3px 6px;
  outline: none;
  cursor: pointer;
  /* GPU-light: backdrop-filter removed for low-spec PCs (Update #182) */
  transition: all 0.2s;
  max-width: 95px;
  box-sizing: border-box;
}

.cust-ui-lang-select:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.5);
}

.cust-ui-lang-select option {
  background: #1e293b;
  color: #ffffff;
  padding: 6px;
}

/* ==================== BIỂU ĐỒ LƯU LƯỢNG KHÁCH HÀNG & KHUNG GIỜ CAO ĐIỂM ==================== */
.traffic-chart-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  margin-top: 20px;
  margin-bottom: 24px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.traffic-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 14px;
}

.traffic-view-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
  flex-wrap: wrap;
}

.traffic-tab-btn {
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.traffic-tab-btn:hover {
  color: #1e293b;
  background: rgba(255, 255, 255, 0.6);
}

.traffic-tab-btn.active {
  background: #ffffff;
  color: #2563eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.traffic-highlights-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.traffic-highlight-pill {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.th-pill-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.th-pill-val {
  font-size: 15px;
  color: #0f172a;
  font-weight: 700;
}

.traffic-chart-visual-box {
  background: #fafafa;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  padding: 24px 16px 16px;
  position: relative;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.traffic-bars-container {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding-bottom: 26px;
  position: relative;
  border-bottom: 1px solid #cbd5e1;
}

.traffic-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
  cursor: pointer;
  min-width: 0;
}

.traffic-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 4px;
  position: relative;
}

.traffic-bar.is-peak {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.45);
}

.traffic-bar-col:hover .traffic-bar {
  filter: brightness(1.15);
  transform: scaleY(1.05);
  transform-origin: bottom;
}

.traffic-bar-count-badge {
  font-size: 10px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 3px;
  white-space: nowrap;
}

.traffic-bar.is-peak + .traffic-bar-count-badge,
.traffic-bar-col:hover .traffic-bar-count-badge {
  color: #d97706;
  font-size: 11px;
}

.traffic-bar-label {
  position: absolute;
  bottom: -22px;
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}

.traffic-chart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: #64748b;
  padding-top: 4px;
}

.traffic-legend {
  display: flex;
  gap: 16px;
  align-items: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-dot.normal {
  background: #2563eb;
}

.legend-dot.peak {
  background: #f59e0b;
}

.traffic-tooltip-box {
  position: absolute;
  background: #0f172a;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -100%);
  margin-top: -12px;
  display: none;
}

.traffic-tooltip-box.show {
  display: block;
}












/* ==================== SIDEBAR TREE NAVIGATION (MỤC CON THEO RỄ CÂY) ==================== */
.sidebar-tree-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: #ffffff;
  animation: fadeIn 0.15s ease-in-out;
}

.sidebar-tree-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.tree-header-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tree-header-icon {
  font-size: 22px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  flex-shrink: 0;
}

.tree-header-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.2;
}

.tree-header-subtitle {
  font-size: 11px;
  color: #64748b;
  margin: 3px 0 0 0;
  line-height: 1.3;
}

.sidebar-tree-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
}

.tree-group {
  margin-bottom: 18px;
}

.tree-root-label {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.3px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
}

.tree-root-branch {
  font-size: 13px;
}

.tree-node-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  padding-left: 4px;
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  color: #334155;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  border-left: 3px solid transparent;
  user-select: none;
  background: transparent;
}

.tree-item:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-left-color: #94a3b8;
}

.tree-item.active {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 600;
  border-left-color: #0284c7;
  box-shadow: 0 1px 2px rgba(2, 132, 199, 0.08);
}

.tree-branch-line {
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
  flex-shrink: 0;
}

.tree-item.active .tree-branch-line {
  color: #0284c7;
  font-weight: bold;
}

.tree-item-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.tree-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

/* Hiệu ứng nổi bật khi cuộn tới thẻ mục tiêu */
@keyframes targetHighlightGlow {
  0% { box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.45); border-color: #0284c7; }
  50% { box-shadow: 0 0 0 6px rgba(2, 132, 199, 0.25); border-color: #0284c7; }
  100% { box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
}

.highlight-glow {
  animation: targetHighlightGlow 1.8s ease-out;
}

/* Khoảng cách cuộn mượt mà từ trên xuống */
.settings-card,
.date-filter-card,
.stats-summary-grid,
.traffic-chart-card,
.agent-performance-card,
.stats-card-box {
  scroll-margin-top: 18px;
}


/* ==========================================================================
   TỐI ƯU MẬT ĐỘ TIN NHẮN CAO (HIGH-DENSITY CHAT LOG) - UPDATE #71
   Tăng sức chứa hiển thị tin nhắn gấp 2.5 lần trong 1 màn hình (viewport),
   giảm triệt để khoảng cách trống, padding, margin, loại bỏ hoàn toàn các khung thừa
   ========================================================================== */

/* 1. Khung hội thoại chính */
.agent-msg-box {
  padding: 12px 16px 28px 16px !important;
  gap: 4px !important;
  background: #f8fafc !important;
}

/* 2. Khung chứa từng bong bóng tin nhắn (Update #90 đồng bộ) */
.agent-bubble-container {
  max-width: 80% !important;
  margin: 5px 0 !important;
}

/* 3. Bong bóng tin nhắn khách hàng */
.agent-bubble-customer {
  padding: 5px 9px !important;
  border-radius: 6px !important;
  line-height: 1.35 !important;
  width: fit-content !important;
}

.agent-bubble-customer .translated-text {
  font-size: 13.5px !important;
  line-height: 1.35 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.agent-bubble-customer .original-text.compact-original {
  font-size: 11px !important;
  border-top: 1px dashed rgba(203, 213, 225, 0.8) !important;
  padding: 2px 0 0 0 !important;
  margin-top: 2px !important;
  line-height: 1.35 !important;
  display: block !important;
  width: 100% !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* 4. Bong bóng tin nhắn nhân viên & bot */
.agent-bubble-me {
  padding: 5px 9px !important;
  border-radius: 6px !important;
  line-height: 1.35 !important;
  width: fit-content !important;
}

.agent-bubble-me .sent-text {
  font-size: 13.5px !important;
  line-height: 1.35 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.agent-bubble-me .translated-sent.compact-translated {
  font-size: 11px !important;
  border-top: 1px dashed rgba(199, 210, 254, 0.8) !important;
  padding: 2px 0 0 0 !important;
  margin-top: 2px !important;
  line-height: 1.35 !important;
  display: block !important;
  width: 100% !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}
.agent-bubble-me .trans-text {
  display: inline-block !important;
  word-break: break-word !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* 5. Nút thu hồi và hàng meta thời gian */
.agent-msg-row-wrapper {
  gap: 4px !important;
}

.btn-recall-msg {
  padding: 0 7px !important;
  font-size: 14px !important;
  height: 28px !important;
  min-width: 28px !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.btn-reply-msg, .btn-copy-img-msg, .btn-ocr-extract, .btn-copy-msg-text {
  padding: 0 7px !important;
  font-size: 14.5px !important;
  height: 28px !important;
  min-width: 28px !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.agent-customer-meta-row, .agent-staff-meta-row {
  margin-top: 1px !important;
  font-size: 10px !important;
  gap: 4px !important;
  line-height: 1.1 !important;
}

/* 6. Ghi chú nội bộ bên phải gọn gàng siêu nhỏ gọn chuẩn Crisp */
.agent-bubble-internal-note {
  padding: 5px 10px !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  margin: 1px 0 !important;
  border-left: 3px solid #ef4444 !important;
}

.agent-bubble-internal-note:has(.chat-img-box:only-child),
.agent-bubble-internal-note:has(.chat-video-box:only-child) {
  padding: 3px !important;
}

.agent-bubble-internal-note .internal-note-text {
  font-size: 13px !important;
  line-height: 1.4 !important;
  color: #4c0519 !important;
}

/* 7. Thông báo hệ thống, banner đổi nhân viên, dải phân cách ngày */
.other-staff-banner {
  padding: 4px 10px !important;
  margin: 2px 10px !important;
  font-size: 11.5px !important;
}

.chat-date-divider {
  margin: 4px 0 !important;
  font-size: 10.5px !important;
}

#historyTopBanner {
  padding: 2px 0 !important;
  margin-bottom: 2px !important;
}

/* 8. Quote card trả lời */
.msg-quote-card {
  padding: 2px 6px !important;
  margin-bottom: 2px !important;
  font-size: 11px !important;
  border-radius: 4px !important;
}


/* ==========================================================================
   NÚT ĐÓNG MODAL / THÔNG BÁO NỔI BẬT GÓC TRÊN BÊN PHẢI (UPDATE #73)
   Đảm bảo tất cả các dấu X thông báo và cửa sổ popup đều nằm góc trên bên phải,
   nổi bật, rõ nét, dễ nhìn và dễ bấm, hover chuyển màu đỏ cảnh báo sắc nét.
   ========================================================================== */

/* 1. Card chứa modal & Header */
.announcement-modal-card,
.modal-card {
  position: relative !important;
}

.modal-card-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 16px 56px 16px 20px !important; /* Dành khoảng trống 56px bên phải để nút X không che chữ */
  border-bottom: 1px solid #e2e8f0 !important;
  position: relative !important;
  box-sizing: border-box !important;
}

/* 2. Nút đóng modal chung (.btn-close-modal & .close-modal) */
.btn-close-modal,
.close-modal {
  position: absolute !important;
  top: 14px !important;
  right: 16px !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: #f1f5f9 !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #334155 !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  z-index: 100 !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  padding: 0 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12) !important;
}

.btn-close-modal:hover,
.close-modal:hover {
  background: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  transform: scale(1.12) !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4) !important;
}

/* 3. Nút đóng toast thông báo nổi góc trên màn hình (.toast-close-btn) */
.floating-broadcast-toast {
  position: relative !important;
  padding-right: 44px !important;
}

.toast-close-btn {
  position: absolute !important;
  top: 10px !important;
  right: 12px !important;
  width: 26px !important;
  height: 26px !important;
  border-radius: 50% !important;
  background: #f1f5f9 !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #334155 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.toast-close-btn:hover {
  background: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  transform: scale(1.12) !important;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.35) !important;
}

/* 4. Nút đóng Flyout cài đặt ngôn ngữ & Dropdown múi giờ (.flyout-close-btn, .tz-close-btn) */
.flyout-header,
.tz-dropdown-header {
  position: relative !important;
  padding-right: 42px !important;
}

.flyout-close-btn {
  position: absolute !important;
  top: 12px !important;
  right: 14px !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  background: #f1f5f9 !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #334155 !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.flyout-close-btn:hover {
  background: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  transform: scale(1.12) !important;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.35) !important;
}

.tz-close-btn {
  position: absolute !important;
  top: 10px !important;
  right: 12px !important;
  width: 26px !important;
  height: 26px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.3) !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
}

.tz-close-btn:hover {
  background: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  transform: scale(1.12) !important;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.35) !important;
}

/* 5. Nút đóng modal ảnh lớn (Lightbox Image Modal) */
#agentImgModal .close-modal {
  top: 24px !important;
  right: 32px !important;
  width: 42px !important;
  height: 42px !important;
  font-size: 24px !important;
  background: rgba(0, 0, 0, 0.5) !important;
  border: 2px solid rgba(255, 255, 255, 0.6) !important;
  color: #ffffff !important;
}

#agentImgModal .close-modal:hover {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  transform: scale(1.15) !important;
}


/* ==========================================================================
   NÚT & DROPDOWN & CARD CHỌN NGÔN NGỮ HỆ THỐNG (UPDATE #74)
   ========================================================================== */
.dock-item-sys-lang {
  position: relative;
}

.dock-sys-lang-dropdown {
  position: fixed;
  left: 74px;
  z-index: 99999;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.25), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  width: 270px;
  overflow: hidden;
  animation: modalPop 0.18s ease-out;
}

.sys-lang-drop-header {
  padding: 10px 36px 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
}

.sys-lang-drop-title {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sys-lang-drop-list {
  padding: 6px;
  max-height: 290px;
  overflow-y: auto;
}

.sys-lang-drop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13px;
  color: #334155;
  font-weight: 500;
}

.sys-lang-drop-item:hover {
  background: #f1f5f9;
  color: #0284c7;
}

.sys-lang-drop-item.active {
  background: #eff6ff;
  color: #0284c7;
  font-weight: 700;
}

.sys-lang-check {
  color: #0284c7;
  font-weight: 700;
  font-size: 14px;
}

/* Grid trong card Cài đặt Hệ thống */
.sys-lang-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.sys-lang-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13.5px;
  font-weight: 500;
  color: #1e293b;
}

.sys-lang-card-item:hover {
  border-color: #0284c7;
  background: #f0f9ff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.15);
}

.sys-lang-card-item.active {
  border-color: #0284c7;
  background: #eff6ff;
  color: #0284c7;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25);
}

/* ==============================================================
   Update #100: Modal & Cards trích xuất số/mã OCR (>= 7 ký tự)
   ============================================================== */
.ocr-modal-box {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  padding: 20px 24px;
  border: 1px solid #e2e8f0;
}

.ocr-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  transition: all 0.15s ease;
  gap: 8px;
}

.ocr-item-card:hover {
  border-color: #3b82f6;
  background: #f8fafc;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.ocr-item-card.is-number {
  border-left: 4px solid #2563eb;
  background: #f0f7ff;
}

.ocr-item-card.is-number:hover {
  background: #e0effe;
}

.ocr-code-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.5px;
  user-select: all;
  word-break: break-all;
}

.ocr-item-card.is-number .ocr-code-val {
  color: #1d4ed8;
  font-size: 16px;
}

.ocr-badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 4px;
  white-space: nowrap;
}

.ocr-badge.badge-number {
  background: #dbeafe;
  color: #1e40af;
}

.ocr-badge.badge-code {
  background: #ede9fe;
  color: #5b21b6;
}

.ocr-badge.badge-word {
  background: #f1f5f9;
  color: #475569;
}

.btn-ocr-card-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-ocr-card-copy {
  background: #2563eb;
  color: #ffffff;
}

.btn-ocr-card-copy:hover {
  background: #1d4ed8;
}

.btn-ocr-card-copy.copied {
  background: #16a34a !important;
  color: #ffffff !important;
}

.btn-ocr-card-paste {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

.btn-ocr-card-paste:hover {
  background: #dbeafe;
}

/* ==============================================================
   Update #102: Nút & Flyout theo dõi trạng thái nhân viên & Force Logout
   ============================================================== */
.dock-staff-status-dot {
  position: absolute;
  top: -2px;
  right: -4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #0f172a;
  box-shadow: 0 0 6px #10b981;
}

.dock-staff-status-flyout {
  display: none;
  position: fixed;
  left: 72px;
  top: 130px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
  width: 240px;
  z-index: 99999;
  padding: 0;
  overflow: hidden;
  animation: fadeIn 0.12s ease-out;
}

.dock-staff-status-flyout.show {
  display: block !important;
}

.agent-mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px 14px;
  border-bottom: 1px solid #f3f4f6;
  background: #ffffff;
}

.agent-mini-title {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.agent-mini-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.agent-tool-btn {
  background: none;
  border: none;
  color: #4b5563;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.agent-tool-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.agent-mini-list {
  display: flex;
  flex-direction: column;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 0 8px 0;
  background: #ffffff;
}

/* Row item */
.agent-mini-row {
  display: flex;
  align-items: center;
  padding: 7px 14px;
  gap: 10px;
  cursor: pointer;
  transition: background 0.12s ease;
  position: relative;
}

.agent-mini-row:hover {
  background: #f3f4f6;
}

.agent-mini-row.active-selection {
  background: #f3f4f6;
}

/* Avatar with status icon badge */
.agent-mini-avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.agent-mini-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #111827;
  display: block;
}

.agent-mini-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-mini-badge.badge-online {
  background: #16a34a;
  color: #ffffff;
}

.agent-mini-badge.badge-away {
  background: #f97316;
  color: #ffffff;
}

.agent-mini-badge.badge-offline {
  background: #9ca3af;
  color: #ffffff;
}

/* Info texts */
.agent-mini-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.agent-mini-line1 {
  display: flex;
  align-items: baseline;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.agent-mini-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-mini-chats {
  font-size: 12px;
  color: #6b7280;
  margin-left: 4px;
  font-weight: 400;
  white-space: nowrap;
}

.agent-mini-sub {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
  line-height: 1.2;
}

/* Subtle action button on hover for admin force logout */
.agent-mini-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.btn-agent-row-logout {
  background: none;
  border: none;
  color: #ef4444;
  padding: 3px 5px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.agent-mini-row:hover .btn-agent-row-logout {
  opacity: 1;
}

.btn-agent-row-logout:hover {
  background: #fee2e2;
}
  flex-shrink: 0;
}

.agent-mini-chats.is-away {
  color: #d97706;
}

.agent-mini-chats.has-unanswered {
  color: #dc2626;
  font-weight: 600;
}

.agent-mini-sub {
  font-size: 11.5px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Row Action (Force Logout icon button) */
.agent-mini-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.btn-agent-row-logout {
  background: none;
  border: none;
  color: #cbd5e1;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.agent-mini-row:hover .btn-agent-row-logout {
  color: #94a3b8;
}

.btn-agent-row-logout:hover {
  background: #fee2e2 !important;
  color: #e11d48 !important;
}

.agent-self-tag {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

/* ========================================================
   KHO ẢNH HƯỚNG DẪN & TÀI LIỆU NGHIỆP VỤ (UPDATE #149 & #152)
   ======================================================== */
.dock-item-guide:hover .dock-icon {
  transform: scale(1.15);
  transition: transform 0.2s ease;
}

/* Update #152 & #154: Định vị Modal Kho Ảnh chỉ phủ vùng khung chat bên phải,
   cách 4 góc một khoảng cách nhỏ tinh tế (10px - 14px), mở rộng tối đa để hiển thị nhiều ảnh nhất có thể */
#modalGuideMaterials,
.guide-materials-overlay {
  position: fixed !important;
  left: 364px !important; /* Sau dock 64px + sidebar danh sách hội thoại 300px */
  top: 58px !important;  /* Dưới thanh user-bar 58px */
  width: calc(100vw - 364px) !important;
  height: calc(100vh - 58px) !important;
  background: rgba(15, 23, 42, 0.4) !important;
  /* GPU-light: backdrop-filter removed for low-spec PCs (Update #182) */
  display: none;
  align-items: center !important;
  justify-content: center !important;
  z-index: 9999 !important;
  box-sizing: border-box !important;
  padding: 10px 14px !important; /* Cách 4 góc một chút tinh tế theo yêu cầu */
}

.guide-materials-modal-card {
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  background: #ffffff !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25) !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  animation: modalPop 0.2s ease-out !important;
  box-sizing: border-box !important;
}

.guide-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.guide-resize-controls {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #e2e8f0;
  padding: 2px;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
}

.btn-guide-resize {
  width: 26px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 5px;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-guide-resize:hover {
  background: #0284c7;
  color: #ffffff;
}

.btn-guide-zoom-pct {
  height: 24px;
  min-width: 44px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 5px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-guide-zoom-pct:hover {
  background: #dbeafe;
  color: #0369a1;
}

/* Toast thông báo nổi toàn cục cho bàn làm việc CSKH (Agent) */
.agent-toast-container {
  position: fixed !important;
  bottom: 28px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 100000 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  pointer-events: none !important;
}
.agent-toast-item {
  background: #0f172a !important;
  color: #ffffff !important;
  padding: 10px 20px !important;
  border-radius: 30px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.4) !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  pointer-events: auto !important;
  animation: toastSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  transition: all 0.25s ease !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}
.agent-toast-item.success {
  background: #065f46 !important;
  border-color: #10b981 !important;
}
.agent-toast-item.warning {
  background: #9a3412 !important;
  border-color: #f97316 !important;
}
.agent-toast-item.error {
  background: #991b1b !important;
  border-color: #ef4444 !important;
}
.agent-toast-item.fade-out {
  opacity: 0 !important;
  transform: translateY(12px) scale(0.95) !important;
}
@keyframes toastSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.guide-modal-header {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 10px 56px 10px 16px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
  flex-shrink: 0 !important;
}

.btn-guide-primary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-guide-primary:hover {
  background: #0369a1;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

.guide-upload-panel {
  background: #f0fdf4;
  border-bottom: 1px solid #bbf7d0;
  padding: 12px 16px;
  flex-shrink: 0;
  animation: slideDownGuide 0.2s ease;
}
@keyframes slideDownGuide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.guide-modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  flex-shrink: 0;
}

.guide-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 5px 10px;
  min-width: 180px;
  flex: 1;
  max-width: 300px;
}
.guide-search-wrap input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 12px;
  color: #0f172a;
}

.guide-cat-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
}
.guide-cat-pill {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.guide-cat-pill:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}
.guide-cat-pill.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

/* Update #153: Lưới tự động co dãn đa cột, thẻ nhỏ gọn chứa được nhiều ảnh nhất có thể */
.guide-cards-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  background: #f8fafc;
  min-height: 260px;
}
.guide-cards-grid {
  --guide-card-min: 145px;
  --guide-thumb-h: 90px;
  --guide-grid-gap: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--guide-card-min), 1fr));
  gap: var(--guide-grid-gap);
}

.guide-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.guide-card:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(2, 132, 199, 0.14);
}

.guide-card-thumb-wrap {
  position: relative;
  width: 100%;
  height: var(--guide-thumb-h);
  background: #0f172a;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-cards-grid.guide-grid-compact .guide-card-body {
  padding: 4px 5px 2px;
}
.guide-cards-grid.guide-grid-compact .guide-card-title {
  font-size: 10px;
  min-height: 24px;
  max-height: 24px;
}
.guide-cards-grid.guide-grid-compact .guide-card-meta {
  font-size: 8.5px;
}
.guide-cards-grid.guide-grid-compact .guide-card-actions {
  padding: 3px 4px;
  gap: 2px;
}
.guide-cards-grid.guide-grid-compact .guide-btn-action {
  font-size: 9.5px;
  padding: 3px 4px;
}
.guide-cards-grid.guide-grid-large .guide-card-title {
  font-size: 12.5px;
  min-height: 32px;
  max-height: 32px;
}
.guide-cards-grid.guide-grid-large .guide-card-meta {
  font-size: 11px;
}
.guide-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Rule #2: Không crop, không méo, giữ trọn vẹn thông tin */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  transition: transform 0.2s ease;
}
.guide-card:hover .guide-card-thumb {
  transform: scale(1.04);
}

.guide-cat-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(15, 23, 42, 0.78);
  /* GPU-light: backdrop-filter removed for low-spec PCs (Update #182) */
  color: #ffffff;
  font-size: 9px;
  font-weight: 600;
  padding: 1.5px 5px;
  border-radius: 3px;
  pointer-events: none;
}

.guide-card-body {
  padding: 5px 7px 3px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.guide-card-title {
  font-size: 11px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 27px;
  max-height: 27px;
}
.guide-card-meta {
  font-size: 9.5px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 2px;
}

.guide-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-top: 1px solid #f1f5f9;
  background: #ffffff;
}
.guide-btn-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 2px;
  border-radius: 5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.guide-btn-send {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}
.guide-btn-send:hover {
  background: #0369a1;
}
.guide-btn-send.sent {
  background: #059669 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
}
.guide-btn-copy {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}
.guide-btn-copy:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.guide-btn-copy.copied {
  background: #dcfce7 !important;
  color: #15803d !important;
  border-color: #86efac !important;
}
.guide-btn-del {
  width: 24px;
  height: 23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 4px;
  background: #f8fafc;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  font-size: 11px;
  padding: 0;
  cursor: pointer;
  transition: all 0.15s;
}
.guide-btn-del:hover {
  color: #ef4444;
  border-color: #fca5a5;
  background: #fef2f2;
}

.guide-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 16px;
  height: 100%;
}

.guide-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  flex-shrink: 0;
}

/* ========================================================
   TỐI ƯU HÓA HIỆU NĂNG MÁY CẤU HÌNH YẾU & MẠNG KÉM (Update #157)
   - content-visibility: auto: Trình duyệt bỏ qua tính toán layout và render
     cho hàng trăm tin nhắn hoặc thẻ hội thoại ngoài màn hình xem. Giảm 80% CPU & RAM.
   - will-change & contain: Tăng tốc cuộn mượt mà trên card đồ họa tích hợp/máy cũ.
   - Giữ nguyên 100% độ sắc nét không nén của ảnh và video (Rule #2).
   ======================================================== */
.conv-item {
  content-visibility: auto;
  contain-intrinsic-size: 0 68px;
}

.agent-bubble-row {
  content-visibility: auto;
  contain-intrinsic-size: 0 52px;
}

.chat-msg-row {
  content-visibility: auto;
  contain-intrinsic-size: 0 52px;
}

.guide-card {
  content-visibility: auto;
  contain-intrinsic-size: 0 175px;
}

.chat-messages,
.agent-chat-messages,
.conv-list,
.guide-cards-container {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Tối ưu hóa GPU cho các thiết bị cấu hình thấp hoặc giảm chuyển động */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==============================================================================
   CẤU HÌNH GIAO DIỆN & BANNER THƯƠNG HIỆU KHÁCH HÀNG (CUSTOMER BRAND HEADER - Update #161)
   ============================================================================== */
.brand-mode-card {
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  background: #ffffff;
  transition: all 0.2s ease;
}
.brand-mode-card:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.brand-mode-card.active {
  border-color: #0284c7;
  background: #f0f9ff;
  box-shadow: 0 0 0 1px #0284c7;
}
.brand-input-ctrl {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  color: #0f172a;
  background: #ffffff;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease;
}
.brand-input-ctrl:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}
.brand-upload-zone {
  border: 2px dashed #93c5fd;
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
}
.brand-upload-zone:hover {
  border-color: #0284c7;
  background: #f0f9ff;
}
.btn-avatar-preset {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-avatar-preset:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.btn-gradient-preset {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: all 0.15s ease;
}
.btn-gradient-preset:hover {
  transform: translateY(-1px);
}
.btn-gradient-preset.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #0284c7, 0 2px 6px rgba(0,0,0,0.3);
}

/* Vỏ mô phỏng Webview / Phone Mockup */
.brand-preview-shell {
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  background: #f1f5f9;
  max-width: 820px;
  margin: 0 auto;
}
.brand-preview-top-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
}
.preview-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.preview-dot.red { background: #ef4444; }
.preview-dot.yellow { background: #f59e0b; }
.preview-dot.green { background: #10b981; }
.preview-url-bar {
  margin-left: 10px;
  background: #ffffff;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 11px;
  color: #475569;
  font-family: monospace;
  flex: 1;
}
.mockup-body-area {
  padding: 16px;
  min-height: 140px;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
}
.mockup-announcement-card {
  background: #ffffff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
}
.mockup-chat-bubble-mock {
  display: flex;
  justify-content: flex-start;
}
.bubble-bot-mock {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 8px 14px;
  border-radius: 12px 12px 12px 2px;
  font-size: 12px;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* BANNER HEADER TRÊN TRANG KHÁCH HÀNG (/customer) VÀ TRONG KHUNG PREVIEW */
.cust-brand-header-banner,
.mockup-header-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 10;
  box-sizing: border-box;
}

/* Chế độ Ảnh Banner Hoàn Chỉnh */
.brand-image-banner-wrap {
  width: 100%;
  display: block;
  line-height: 0;
  text-align: center;
}
.brand-image-banner-img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  display: block;
}

/* Chế độ Component Banner (Responsive Flex Layout) */
.brand-component-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 12px;
  min-height: 70px;
  box-sizing: border-box;
  color: #ffffff;
  direction: ltr; /* Giữ layout logo trái - mascot phải chuẩn quốc tế */
}

/* Nút Tắt / Thoát ⏻ góc trên cùng */
.brand-header-close-btn {
  position: absolute;
  top: 6px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 20;
}
.brand-header-close-btn:hover {
  background: rgba(239, 68, 68, 0.85);
  border-color: #ef4444;
}

/* Cột Trái: Tên Thương Hiệu (Text Wordmark phân biệt chữ hoa chữ thường - Update #170) */
.brand-col-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  min-width: 110px;
  max-width: 240px;
}
.brand-text-logo {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}
.brand-wordmark-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
}
.brand-wordmark-line {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.4px;
  text-transform: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 230px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}
.brand-wordmark-main {
  color: #ffffff;
  text-transform: none !important;
}
.brand-wordmark-ext {
  color: #22c55e;
  font-size: 0.72em;
  font-weight: 800;
  text-transform: none !important;
}
.brand-wordmark-underline {
  width: 100%;
  height: 2.5px;
  margin-top: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e 0%, #4ade80 75%, transparent 100%);
}
.brand-logo-img {
  height: 42px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  display: block;
}
.brand-name-fallback {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #ffffff;
  text-transform: none !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

/* Cột Giữa: Slogan & 3 Cam Kết Dịch Vụ */
.brand-col-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 8px;
  min-width: 0;
}
.brand-support-title {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.brand-benefits-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.brand-benefit-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: #e2e8f0;
  white-space: nowrap;
}
.brand-benefit-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #22c55e;
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  flex-shrink: 0;
}

/* Cột Phải: Mascot Avatar & Badge */
.brand-col-mascot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 18px; /* chừa khoảng trống cho nút ⏻ */
}
.brand-mascot-avatar-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.brand-mascot-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  border: 2px solid #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
  background: #052e16;
}
.brand-badge-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.15;
}
.brand-badge-top {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.brand-badge-sub {
  font-size: 14px;
  font-weight: 900;
  color: #fbbf24;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Responsive khi xem trên điện thoại / màn hình nhỏ */
@media (max-width: 640px) {
  .brand-component-wrap {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
  }
  .brand-col-logo {
    min-width: 90px;
    max-width: 165px;
  }
  .brand-wordmark-line {
    font-size: 18px;
    max-width: 160px;
  }
  .brand-logo-img {
    height: 32px;
    width: auto;
    max-width: 130px;
    display: block;
  }
  .brand-support-title {
    font-size: 11px;
    margin-bottom: 4px;
  }
  .brand-benefits-row {
    gap: 6px;
  }
  .brand-benefit-item {
    font-size: 10px;
  }
  .brand-mascot-avatar-wrap,
  .brand-mascot-img {
    width: 38px;
    height: 38px;
  }
  .brand-badge-top {
    font-size: 10px;
  }
  .brand-badge-sub {
    font-size: 12px;
  }
}

/* ==================== NÚT HỦY TẢI LÊN & MODAL XÁC NHẬN HỦY GỬI TỆP ==================== */
.btn-cancel-upload {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  border-radius: 50% !important;
  width: 22px !important;
  height: 22px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
}
.btn-cancel-upload:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
}

.cancel-confirm-box {
  background: #ffffff;
  border-radius: 14px;
  padding: 24px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  animation: modalScaleIn 0.2s ease-out;
}
.cancel-confirm-icon {
  font-size: 36px;
  margin-bottom: 10px;
}
.cancel-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}
.btn-cancel-action {
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}
.btn-cancel-resume {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}
.btn-cancel-resume:hover {
  background: #e2e8f0;
}
.btn-cancel-agree {
  background: #ef4444;
  color: #ffffff;
}
.btn-cancel-agree:hover {
  background: #dc2626;
}

/* Modal Chỉnh Sửa Nhân Viên: Tăng chiều rộng gấp 1.5 lần (570px) & cuộn nội bộ tránh tràn màn hình */
#modalEditUser .login-box {
  max-width: 570px !important;
  width: 95% !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
  padding: 24px 28px !important;
  box-sizing: border-box !important;
}

/* ==================== NÚT YÊU CẦU TRỢ GIÚP (@NHẮC ĐỒNG NGHIỆP) & CẢNH BÁO ƯU TIÊN (UPDATE #167) ==================== */
.help-mention-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-composer-mode.btn-mode-help {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}
.btn-composer-mode.btn-mode-help:hover,
.btn-composer-mode.btn-mode-help.open {
  background: #ffedd5;
  border-color: #f97316;
  color: #7c2d12;
}
.mode-tag-pill.mode-tag-help {
  background: #fed7aa;
  color: #9a3412;
  font-weight: 700;
}

.help-mention-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 280px;
  max-width: 85vw;
  background: #ffffff;
  border: 1px solid #fdba74;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
  z-index: 1200;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.help-mention-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  font-size: 12px;
  font-weight: 700;
  color: #9a3412;
}

.help-popup-close {
  border: none;
  background: transparent;
  color: #9a3412;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
}
.help-popup-close:hover {
  background: #fed7aa;
}

.help-mention-popup-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 5px;
}

.help-mention-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: none;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}
.help-mention-item:hover {
  background: #fff7ed;
}
.help-mention-avatar-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.help-mention-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #e2e8f0;
}
.help-mention-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
}
.help-mention-dot.online { background: #10b981; }
.help-mention-dot.stealth { background: #f59e0b; }
.help-mention-dot.offline { background: #94a3b8; }

.help-mention-info {
  flex: 1;
  min-width: 0;
}
.help-mention-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.help-mention-sub {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.help-mention-status-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.help-mention-status-tag.online { background: #dcfce7; color: #166534; }
.help-mention-status-tag.stealth { background: #fef3c7; color: #92400e; }
.help-mention-status-tag.offline { background: #f1f5f9; color: #64748b; }

/* Cảnh báo ưu tiên ở đầu danh sách hội thoại của nhân viên được @tag */
.help-alerts-banner {
  background: #fef2f2;
  border-bottom: 2px solid #fca5a5;
  padding: 6px 8px;
  flex-shrink: 0;
}

.help-alerts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  padding: 0 2px;
}

.help-alerts-title {
  font-size: 11.5px;
  font-weight: 800;
  color: #b91c1c;
  letter-spacing: 0.2px;
}

.help-alerts-count {
  background: #dc2626;
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.help-alerts-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 175px;
  overflow-y: auto;
}

.help-alert-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #fca5a5;
  border-left: 3.5px solid #dc2626;
  border-radius: 7px;
  padding: 6px 8px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.help-alert-card:hover {
  background: #fff7ed;
  border-color: #ef4444;
}

.help-alert-body {
  flex: 1;
  min-width: 0;
}

.help-alert-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.help-alert-from {
  font-size: 11.5px;
  font-weight: 700;
  color: #b91c1c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.help-alert-time {
  font-size: 10px;
  color: #64748b;
  flex-shrink: 0;
}

.help-alert-cust {
  font-size: 11.5px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.help-alert-cta {
  font-size: 10.5px;
  color: #c2410c;
  font-weight: 600;
  margin-top: 1px;
}

.help-alert-dismiss {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}
.help-alert-dismiss:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}






