/* ==============================================================================
   RIN.IPOD MINIMALISM DESIGN SYSTEM
   Matching Music Downloader, iPod HDD Doctor & iPod QC Tester by Rin.iPod
   ============================================================================== */

:root {
  --bg-primary: #e4e2dd;       /* Main window background (COLOR_BG) */
  --bg-card: #dbd8d1;          /* Outer card container (COLOR_CARD) */
  --bg-input: #eeece7;         /* Inset panels & inputs (COLOR_INPUT_BG) */
  --bg-hover: #d6d2cb;         /* Hover surface */
  --bg-btn-hover: #d1cdb5;     /* Secondary button hover */
  --border-color: #cfcbc2;     /* Crisp 1px borders (COLOR_BORDER) */
  --text-main: #1c1917;        /* Deep stone charcoal (COLOR_TEXT_MAIN) */
  --text-muted: #57534e;       /* Muted warm gray (COLOR_TEXT_MUTED) */
  --primary: #292524;          /* Stone 800 primary CTA (COLOR_ACCENT) */
  --primary-hover: #44403c;    /* Stone 700 hover (COLOR_ACCENT_HOVER) */
  --progress-color: #1c1917;   /* Progress bar fill (COLOR_PROGRESS) */
  --accent-green: #15803d;     /* Good / Success */
  --accent-blue: #1d4ed8;      /* Info / Classic Blue */
  --accent-orange: #b45309;    /* Warning / Pending */
  --accent-red: #b91c1c;       /* Danger / Bad */
  --accent-purple: #6d28d9;    /* Fixed / Accent */
  --ig-color: #e1306c;         /* Instagram badge */
  --threads-color: #1c1917;    /* Threads badge */
  --zalo-color: #1d4ed8;       /* Zalo badge */
  --font-family: "IBM Plex Mono", "JetBrains Mono", "Consolas", "Courier New", monospace;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", "Consolas", "Courier New", monospace;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 13px;
  letter-spacing: -0.15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

button,
input,
select,
textarea {
  font-family: var(--font-family);
}

/* Custom Warm-Stone Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c2bdb3;
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a298;
}

/* ==============================================================================
   TRANSPARENT HEADER (Matches Rin.iPod Desktop Apps)
   ============================================================================== */
header.rin-header {
  background: transparent;
  padding: 16px 28px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-text h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
  line-height: 1.2;
}

.header-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ch-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.ch-chip.connected {
  color: var(--text-main);
  border-color: #a8a298;
}

.live-auto-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.live-auto-btn:hover {
  background: var(--bg-hover);
}

.live-auto-btn.active {
  background: var(--accent-green);
  color: #ffffff;
  border-color: var(--accent-green);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-green);
  background: var(--bg-card);
  padding: 5px 11px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.status-badge.offline {
  color: var(--accent-red);
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(21, 128, 61, 0.45);
  animation: pulse 2s infinite;
}

.status-badge.offline .status-dot {
  background: var(--accent-red);
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  0% { opacity: 0.55; }
  50% { opacity: 1; }
  100% { opacity: 0.55; }
}

/* ==============================================================================
   MAIN WORKSPACE: SEGMENTED TABS + OUTER CARD SHELL (#dbd8d1)
   ============================================================================== */
main.rin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 28px;
  min-height: 0;
}

/* Segmented Tab Bar + Simulator Toggle Row (Matches CTkTabview) */
.tabs-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.nav-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  background: var(--bg-input);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  max-width: 100%;
  overflow-x: auto;
}

.btn-toggle-sim {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.btn-toggle-sim:hover {
  background: var(--bg-btn-hover);
}

.btn-toggle-sim.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.nav-tab {
  padding: 7px 16px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.nav-tab:hover {
  background: var(--border-color);
}

.nav-tab.active {
  background: var(--primary);
  color: #ffffff;
}

.nav-tab.active:hover {
  background: var(--primary-hover);
}

/* Outer Card Shell */
.rin-card-shell {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tab-pane {
  display: none;
  flex: 1;
  min-height: 0;
}

.tab-pane.active {
  display: flex;
  flex-direction: column;
}

/* ==============================================================================
   TAB 1: OMNICHANNEL INBOX & SIMULATOR
   ============================================================================== */
#inbox-tab {
  padding: 14px 16px;
  gap: 12px;
}

/* Simulator Topbar (Transparent inside #dbd8d1 card) */
.simulator-topbar {
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.simulator-topbar.collapsed {
  display: none;
}

.field-caption {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.sim-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sim-select {
  height: 38px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.sim-select:focus {
  border-color: var(--primary);
}

.sim-input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.sim-input::placeholder {
  color: #78716c;
}

.sim-input:focus {
  border-color: var(--primary);
  background: #f5f4f0;
}

.btn-primary {
  height: 38px;
  padding: 0 16px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.quick-prompts {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.quick-prompts span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.prompt-chip {
  padding: 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}

.prompt-chip:hover {
  background: var(--bg-hover);
  border-color: #b8b3a8;
}

/* 3-Column Inset Grid inside #dbd8d1 Card */
.inbox-container {
  flex: 1;
  display: grid;
  grid-template-columns: 340px minmax(360px, 1fr) 340px;
  gap: 12px;
  min-height: 0;
}

/* Left Column: Conversations Sidebar (#eeece7) */
.inbox-sidebar {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.conv-search {
  width: 100%;
  height: 35px;
  padding: 0 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 13px;
  outline: none;
  margin-bottom: 9px;
}

.conv-search::placeholder {
  color: #78716c;
}

.conv-search:focus {
  border-color: var(--primary);
  background: #f5f4f0;
}

.platform-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.status-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.filter-btn,
.status-filter-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s;
}

.filter-btn:hover,
.status-filter-btn:hover {
  background: var(--bg-hover);
}

.filter-btn.active,
.status-filter-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-mini-inline {
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 10px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-mini-inline:hover {
  background: var(--bg-btn-hover);
}

.btn-mini-inline:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.conv-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.15s;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.conv-item:hover {
  background: var(--bg-primary);
}

.conv-item.is-unreplied {
  border-left: 3px solid var(--accent-orange);
}

.conv-item.is-hidden-conv {
  background: rgba(109, 40, 217, 0.04);
  border-left: 3px solid var(--accent-purple);
}

.conv-item.active {
  background: var(--bg-card);
  border-left: 3px solid var(--primary);
}

.conv-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
}

.conv-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.conv-avatar img,
.avatar-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.avatar-initial {
  font-weight: 700;
  font-size: 16px;
  color: #ffffff;
  text-transform: uppercase;
  user-select: none;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.avatar-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 2;
}

.platform-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #ffffff;
  border: 2px solid var(--bg-input);
  z-index: 5;
}

.platform-instagram { background: var(--ig-color); }
.platform-threads { background: var(--threads-color); }
.platform-zalo { background: var(--zalo-color); }

.conv-info {
  flex: 1;
  min-width: 0;
}

.conv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.conv-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.1px;
}

.conv-header-right {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  max-width: 62%;
}

.conv-crm-tags {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.conv-crm-tag {
  display: inline-flex;
  align-items: center;
  padding: 1.5px 6px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
  white-space: nowrap;
  letter-spacing: -0.1px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.conv-crm-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9);
}

.chat-header-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.chat-header-tags {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.chat-header-tags .conv-crm-tag {
  font-size: 10.5px;
  padding: 2px 7px;
}

.conv-time {
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
  font-weight: 500;
}

.conv-preview {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.conv-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.badge {
  font-size: 11px;
  padding: 2.5px 7px;
  border-radius: 4px;
  font-weight: 700;
}

.badge-answered {
  background: rgba(21, 128, 61, 0.14);
  color: var(--accent-green);
}

.badge-ai-replied {
  background: rgba(21, 128, 61, 0.18);
  color: var(--accent-green);
}

.badge-unreplied,
.badge-pending {
  background: rgba(180, 83, 9, 0.14);
  color: var(--accent-orange);
}

.badge-request {
  background: rgba(29, 78, 216, 0.12);
  color: var(--accent-blue);
}

.badge-hidden {
  background: rgba(109, 40, 217, 0.14);
  color: var(--accent-purple);
}

.badge-sim {
  background: rgba(29, 78, 216, 0.12);
  color: var(--accent-blue);
}

.badge-unread-dot {
  background: rgba(185, 28, 28, 0.12);
  color: var(--accent-red);
}

.badge-group {
  background: rgba(15, 23, 42, 0.08);
  color: #334155;
}

.badge-stranger {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

.request-folder-banner {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-orange);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-main);
}

.request-folder-banner.is-hidden {
  border-left-color: var(--accent-purple);
}

.request-folder-banner-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.request-folder-banner-link:hover {
  background: var(--primary-hover);
}

.btn-load-more {
  width: calc(100% - 20px);
  margin: 10px;
  padding: 7px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.btn-load-more:hover {
  background: var(--bg-hover);
}

.hidden-limit-notice {
  margin: 10px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-purple);
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hidden-limit-notice a {
  align-self: flex-start;
  padding: 4px 9px;
  border-radius: 5px;
  background: var(--primary);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.hidden-limit-notice a:hover {
  background: var(--primary-hover);
}

/* Middle Column: Chat Window (#eeece7) */
.chat-window {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.chat-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-header-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-mini {
  padding: 5px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s;
}

.btn-mini:hover {
  background: var(--bg-btn-hover);
}

.btn-mini:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.msg-img-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg-img-grid.is-multi {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 160px));
  gap: 6px;
}

.msg-img {
  max-width: 240px;
  max-height: 240px;
  border-radius: 8px;
  display: block;
  margin-top: 4px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  object-fit: cover;
}

.msg-img-grid.is-multi .msg-img {
  width: 100%;
  max-width: 160px;
  height: 140px;
  margin-top: 0;
}

.msg-img-fallback {
  font-size: 12px;
  opacity: 0.8;
}

.msg-link-card {
  display: flex;
  flex-direction: column;
  width: 260px;
  max-width: 100%;
  margin-top: 6px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: var(--bg-primary, #f7f6f2);
  color: var(--text-main, #1f1f1f);
  text-decoration: none;
  white-space: normal;
  transition: box-shadow 0.15s;
}

.msg-link-card:first-child {
  margin-top: 0;
}

a.msg-link-card:hover {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.message-bot .msg-link-card {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.msg-link-thumb {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.05);
}

.msg-link-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.msg-link-sub {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.78;
}

.msg-link-title {
  font-size: 12.5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.msg-link-url {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-inline-link {
  color: #1565c0;
  text-decoration: underline;
  word-break: break-all;
}

.message-bot .msg-inline-link {
  color: #dbeafe;
}

.messages-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overflow-anchor: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.message-group {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}

.message-customer {
  align-self: flex-start;
}

.message-bot {
  align-self: flex-end;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-customer .message-bubble {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.message-bot .message-bubble {
  background: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.message-bot.admin-reply .message-bubble {
  background: var(--primary-hover);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 2px;
}

.message-bot .message-meta {
  justify-content: flex-end;
}

.ai-tag {
  color: var(--accent-green);
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Copilot Review Box */
.copilot-review-box {
  background: var(--bg-primary);
  border: 1px solid var(--accent-orange);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
}

.copilot-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-orange);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.copilot-text {
  font-size: 12.5px;
  color: var(--text-main);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 10px;
  white-space: pre-wrap;
  margin-bottom: 10px;
}

.copilot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-approve {
  padding: 6px 12px;
  background: var(--accent-green);
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.btn-approve:hover {
  opacity: 0.92;
}

.btn-edit {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.btn-edit:hover {
  background: var(--bg-hover);
}

/* Bottom Chat Input Bar */
.chat-input-bar {
  padding: 10px 12px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.chat-input-field {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 13px;
  outline: none;
}

.chat-input-field::placeholder {
  color: #78716c;
}

.chat-input-field:focus {
  border-color: var(--primary);
  background: #f5f4f0;
}

/* Right Column: POS & SPX / CRM / AI Inspector (#eeece7) */
.ai-inspector {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.inspector-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
}

.card-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.intent-pill {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 5px 10px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 4px;
  margin-bottom: 6px;
}

.confidence-bar-wrap {
  margin-top: 4px;
}

.confidence-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.confidence-bar {
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.confidence-fill {
  height: 100%;
  background: var(--progress-color);
  border-radius: 3px;
  width: 0%;
  transition: width 0.35s ease;
}

.matched-template-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-main);
}

.matched-title {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

/* ==============================================================================
   TAB 2: TEMPLATES MANAGER (Inside #dbd8d1 Card Shell)
   ============================================================================== */
.templates-view {
  flex: 1;
  padding: 18px 20px;
  overflow-y: auto;
  min-height: 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.section-header p {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.template-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}

.template-card:hover {
  border-color: #a8a298;
}

.template-cat {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.35px;
  margin-bottom: 4px;
}

.template-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.template-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.kw-tag {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.template-content {
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.5;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 12px;
  max-height: 125px;
  overflow-y: auto;
  white-space: pre-wrap;
  flex: 1;
}

.template-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-secondary {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-secondary:hover {
  background: var(--bg-btn-hover);
}

.btn-danger {
  padding: 6px 12px;
  background: rgba(185, 28, 28, 0.08);
  border: 1px solid rgba(185, 28, 28, 0.28);
  border-radius: 6px;
  color: var(--accent-red);
  font-family: var(--font-family);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.btn-danger:hover {
  background: var(--accent-red);
  color: #ffffff;
}

/* ==============================================================================
   TAB 3 & TAB 4: SETTINGS & WEBHOOKS (Inside #dbd8d1 Card Shell)
   ============================================================================== */
.settings-view {
  flex: 1;
  padding: 18px 20px;
  overflow-y: auto;
  width: 100%;
  min-height: 0;
}

.settings-view-inner {
  max-width: 920px;
  margin: 0 auto;
}

.settings-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.settings-card h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  font-family: var(--font-family);
  transition: border-color 0.15s, background-color 0.15s;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #78716c;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--primary);
  background: #f5f4f0;
}

.form-textarea {
  min-height: 76px;
  resize: vertical;
}

.mono-input {
  font-family: var(--font-mono);
  font-size: 12px;
}

code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text-main);
}

input[type="range"] {
  accent-color: var(--primary);
}

.toggle-switch-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--border-color);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: 0.25s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--primary);
  transition: 0.25s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

input:checked + .slider:before {
  background-color: #ffffff;
  transform: translateX(20px);
}

/* ==============================================================================
   SIGNATURE RIN.IPOD FOOTER (Transparent, Copyright, Zalo, Threads, Cat Logo)
   ============================================================================== */
footer.rin-footer {
  background: transparent;
  padding: 8px 28px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 16px;
}

.footer-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.copyright {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.social-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s;
}

.social-btn:hover {
  background: var(--bg-hover);
}

.social-btn img {
  height: 17px;
  width: auto;
  display: block;
}

.footer-logo {
  height: 60px;
  width: auto;
  display: block;
  object-fit: contain;
}

/* ==============================================================================
   MODAL & TOASTS
   ============================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(28, 25, 23, 0.45);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  width: 550px;
  max-width: 92vw;
  max-height: 86vh;
  overflow-y: auto;
  padding: 20px 22px;
  box-shadow: 0 12px 32px rgba(28, 25, 23, 0.22);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text-main);
}

.modal-content .form-input,
.modal-content .form-textarea,
.modal-content .form-select {
  background: var(--bg-input);
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(28, 25, 23, 0.16);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==============================================================================
   ACTIVITY LOG, CHANNEL CHECKBOXES, OMNICAKE REALTIME CONNECTIONS
   ============================================================================== */
.activity-log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.activity-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 11px;
  line-height: 1.4;
}

.activity-item-head {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.activity-item-action {
  font-weight: 700;
  color: var(--accent-green);
}

.activity-item-action.pending {
  color: var(--accent-orange);
}

.channel-checks-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.ch-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}

.ch-checkbox-label input {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.conn-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.conn-status-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.conn-status-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.conn-status-value {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.conn-status-value.ok {
  color: var(--accent-green);
}

.conn-status-value.err {
  color: var(--accent-red);
}

.inline-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.zalo-qr-wrap {
  margin-top: 10px;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: none;
  align-items: center;
  gap: 14px;
}

.zalo-qr-wrap img {
  width: 150px;
  height: 150px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  object-fit: contain;
}

.details-webhooks {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 18px;
}

.details-webhooks summary {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.details-webhooks[open] summary {
  margin-bottom: 14px;
}

/* ==============================================================================
   TEMPLATE ACTIONS, SHORTCUTS, IMPORT MODAL & CHAT QUICK-REPLY PICKER
   ============================================================================== */
.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-actions .btn-secondary {
  height: 38px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  border-radius: 8px;
}

.template-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.shortcut-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Quick-Reply Popover inside Chat Window */
.quick-reply-popover {
  position: absolute;
  bottom: 62px;
  left: 12px;
  right: 12px;
  max-height: 300px;
  background: var(--bg-input);
  border: 1px solid #a8a298;
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(28, 25, 23, 0.2);
  display: none;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
}

.qr-popover-header {
  padding: 8px 10px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-popover-header input {
  flex: 1;
  height: 30px;
  padding: 0 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-main);
  outline: none;
}

.qr-popover-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qr-popover-item {
  padding: 8px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.qr-popover-item:hover {
  background: var(--bg-hover);
}

.qr-popover-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.qr-popover-item-preview {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Import Modal (Wide + Sub-tabs + Extract Cards) */
.modal-content.modal-wide {
  width: 780px;
  max-width: 94vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.import-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 12px;
}

.import-tab-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.import-tab-btn:hover {
  background: var(--border-color);
}

.import-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.import-pane {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.import-pane.active {
  display: flex;
}

.info-banner {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.5;
}

.extract-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.extract-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 44vh;
  overflow-y: auto;
  padding-right: 4px;
}

.extract-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.extract-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.extract-check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
}

.extract-check-label input {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.freq-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(29, 78, 216, 0.12);
  color: var(--accent-blue);
}

.saved-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(21, 128, 61, 0.14);
  color: var(--accent-green);
}

.extract-questions {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 9px;
}

.extract-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr 0.9fr;
  gap: 8px;
}

.extract-input,
.extract-textarea {
  width: 100%;
  padding: 6px 9px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: var(--font-family);
  font-size: 12px;
  color: var(--text-main);
  outline: none;
}

.extract-textarea {
  min-height: 58px;
  resize: vertical;
}

/* ==============================================================================
   CONVERSATION HISTORY LOADER & CALENDAR DATE DIVIDERS
   ============================================================================== */
.history-loader-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
}

.history-loader-info {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.history-loader-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-history-more {
  padding: 5px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-history-more:hover:not(:disabled) {
  background: var(--bg-btn-hover);
}

.btn-history-all {
  padding: 5px 10px;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  color: #fafaf9;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-history-all:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-history-more:disabled,
.btn-history-all:disabled {
  opacity: 0.55;
  cursor: wait;
}

.history-day1-divider {
  align-self: center;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 4px 14px;
  margin: 2px 0 6px;
}

.msg-date-divider {
  align-self: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 8px 0 4px;
}

/* ==============================================================================
   REQUEST ACCEPT & BATCH CONTROLS
   ============================================================================== */
.request-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-accept-reply {
  padding: 5px 10px;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  color: #fafaf9;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-accept-reply:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-accept-only {
  padding: 5px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-accept-only:hover:not(:disabled) {
  background: var(--bg-btn-hover);
}

.btn-accept-reply:disabled,
.btn-accept-only:disabled {
  opacity: 0.55;
  cursor: wait;
}

.batch-request-bar {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 4px 2px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.batch-request-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
}

.batch-request-sub {
  font-size: 10.5px;
  color: var(--text-muted);
}

.batch-progress-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.batch-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.25s ease;
}

/* ==============================================================================
   RIGHT COLUMN TABS, POS MINI, SPX EXPRESS & CRM (Rin.iPod Minimalism)
   ============================================================================== */
.right-panel-tabs {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: 4px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  flex-shrink: 0;
}

.right-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.right-tab-btn:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

.right-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.tab-detect-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ea580c;
  display: inline-block;
  flex-shrink: 0;
}

.right-tab-btn.active .tab-detect-dot {
  background: #fb923c;
}

.tab-count-mini {
  background: rgba(28, 25, 23, 0.12);
  color: inherit;
  border-radius: 999px;
  padding: 0 5px;
  font-size: 10px;
  line-height: 1.5;
  font-weight: 700;
}

.right-tab-btn.active .tab-count-mini {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.right-tab-pane {
  display: none;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.right-tab-pane.active {
  display: flex;
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
}

/* Auto-Detection Status Card */
.pos-detect-card {
  padding: 9px 10px;
  border-style: dashed;
}

.pos-detect-card.has-full {
  border-style: solid;
  border-color: rgba(21, 128, 61, 0.4);
  background: rgba(21, 128, 61, 0.06);
}

.pos-detect-card.has-partial {
  border-style: solid;
  border-color: rgba(194, 65, 12, 0.35);
  background: rgba(234, 88, 12, 0.05);
}

.pos-detect-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.pos-detect-status {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.pos-phone-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.pos-phone-chips:empty {
  display: none;
}

.pos-phone-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.pos-phone-chip:hover {
  background: var(--bg-card);
  border-color: var(--primary);
}

.pos-addr-hint {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

/* POS Inputs */
.pos-field {
  margin-bottom: 8px;
}

.pos-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.pos-input,
.pos-textarea,
.pos-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 12px;
  padding: 6px 8px;
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.pos-input:focus,
.pos-textarea:focus,
.pos-select:focus {
  border-color: var(--primary);
  background: #f5f4f0;
}

.pos-money-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pos-money-input {
  padding-right: 19px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.pos-money-unit {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  opacity: 0.78;
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

.pos-textarea {
  resize: vertical;
  min-height: 46px;
  line-height: 1.4;
}

.pos-inline-input {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pos-inline-input .pos-input {
  flex: 1;
}

.pos-row-2 {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 6px;
}

.pos-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.pos-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 7px;
}

.pos-preset-chip {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pos-preset-chip:hover {
  border-color: var(--primary);
  color: var(--text-main);
  background: var(--bg-card);
}

.pos-total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 9px;
  margin: 4px 0 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.pos-total-value {
  font-size: 14.5px;
  font-weight: 800;
  color: #c2410c;
}

.btn-spx-create {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.btn-spx-create:hover {
  filter: brightness(0.95);
}

.btn-spx-create:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.pos-secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.pos-secondary-actions .btn-mini {
  width: 100%;
  justify-content: center;
  padding: 5px 6px;
  font-size: 11px;
}

.pos-latest-order-card {
  padding: 9px 10px;
}

/* CRM Tags, Orders & Notes */
.crm-tags-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.crm-tag-mode-switch {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.crm-tag-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.crm-tag-mode-btn:hover {
  color: var(--text-main);
}

.crm-tag-mode-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.crm-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.crm-tag-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.crm-tag-chip.active .crm-tag-dot {
  background: #ffffff !important;
}

.crm-tag-count {
  font-size: 10px;
  opacity: 0.8;
  font-weight: 700;
}

.crm-active-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px dashed var(--border-color);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
}

.crm-clear-filter-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.crm-clear-filter-btn:hover {
  background: var(--bg-hover);
}

/* AI Tab: Quick Replies Card */
#right-pane-ai.active {
  overflow: hidden;
}

.ai-qr-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ai-qr-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.ai-add-tpl-form {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.ai-add-tpl-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}

.ai-btn-save {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
}

.ai-qr-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.ai-qr-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 9px;
  transition: border-color 0.15s, background-color 0.15s, opacity 0.15s;
}

.ai-qr-item.is-dragging {
  opacity: 0.45;
}

.ai-qr-item.is-drag-over {
  border-color: var(--primary);
  box-shadow: 0 -2px 0 0 var(--primary);
}

.ai-qr-drag-handle {
  color: var(--text-muted);
  cursor: grab;
  font-size: 12px;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
  padding-right: 2px;
}

.ai-qr-drag-handle:active {
  cursor: grabbing;
}

.ai-qr-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.ai-qr-item:hover {
  border-color: var(--primary);
}

.ai-qr-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}

.ai-qr-item-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.ai-qr-item-shortcut {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-blue);
  background: rgba(37, 99, 235, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}

.ai-qr-item-preview {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
  white-space: pre-wrap;
}

.ai-qr-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 6px;
}

.ai-qr-item-btns {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ai-qr-mini-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2.5px 7px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.ai-qr-mini-btn:hover {
  background: var(--bg-hover);
}

.ai-qr-mini-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ai-qr-body-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.ai-qr-thumb {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  cursor: pointer;
  background: #ffffff;
}

.ai-qr-multi-badge {
  font-size: 9.5px;
  font-weight: 700;
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}

.tpl-img-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.tpl-img-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 3px 6px 3px 3px;
}

.tpl-img-preview img {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  object-fit: cover;
  display: block;
}

.tpl-img-clear-btn {
  border: none;
  background: transparent;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
}

.chat-pending-media-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-input);
  border-top: 1px solid var(--border-color);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
}

.chat-pending-media-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-pending-media-bar img {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.msg-video-wrap {
  margin-top: 2px;
  border-radius: 10px;
  overflow: hidden;
  background: #000000;
  max-width: 300px;
}

.msg-video {
  display: block;
  width: 100%;
  max-width: 280px;
  max-height: 290px;
  border-radius: 10px;
  background: #000000;
}

/* Zalo-style Grouped Media Album Grid */
.msg-album-grid {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  overflow: hidden;
  max-width: 292px;
}

.msg-album-grid.cols-2 {
  grid-template-columns: repeat(2, 130px);
}

.msg-album-grid.cols-3 {
  grid-template-columns: repeat(3, 94px);
}

.msg-album-tile {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.12);
}

.msg-album-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.msg-album-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  padding-left: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.msg-album-dur {
  position: absolute;
  right: 4px;
  bottom: 4px;
  background: rgba(0, 0, 0, 0.68);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.3;
  pointer-events: none;
}

.media-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.media-lightbox-inner {
  position: relative;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-lightbox-inner img,
.media-lightbox-inner video {
  max-width: 90vw;
  max-height: 86vh;
  border-radius: 10px;
  background: #000000;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.media-lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ai-qr-mini-btn.is-send {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.ai-qr-mini-btn.is-del:hover {
  color: #b91c1c;
  border-color: #fca5a5;
}

.crm-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.crm-tag-chip:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.crm-tag-chip.active {
  color: #ffffff;
  border-color: transparent;
}

.crm-orders-list,
.crm-notes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crm-empty-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.crm-order-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 9px;
  font-size: 11.5px;
}

.crm-order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}

.crm-order-code {
  font-weight: 800;
  color: var(--text-main);
}

.crm-order-cod {
  font-weight: 800;
  color: #c2410c;
}

.crm-order-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.crm-order-tracking {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 3px;
}

.crm-order-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.crm-note-form {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
}

.crm-note-form .pos-input {
  flex: 1;
}

.crm-note-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 11.5px;
}

.crm-note-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.crm-note-del {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0 3px;
}

.crm-note-del:hover {
  color: var(--accent-red);
}

/* Inline Clickable Phone Badge in Chat Bubbles */
.chat-phone-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(234, 88, 12, 0.14);
  color: #9a3412;
  border: 1px solid rgba(234, 88, 12, 0.35);
  transition: all 0.15s ease;
}

.chat-phone-chip:hover {
  background: #c2410c;
  color: #ffffff;
  border-color: #c2410c;
}

.message-bot .chat-phone-chip {
  background: rgba(255, 255, 255, 0.18);
  color: #fed7aa;
  border-color: rgba(254, 215, 170, 0.45);
}

.message-bot .chat-phone-chip:hover {
  background: #ea580c;
  color: #ffffff;
}

/* SPX Print Bill Modal */
.modal-overlay.open {
  display: flex;
}

.modal-content.spx-modal-content {
  width: 580px;
}

.spx-bill-print-area {
  margin-bottom: 10px;
}

.spx-bill-sheet {
  border: 2px solid #c2410c;
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  color: #1c1917;
  font-family: var(--font-family);
}

.spx-local-note {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.45;
}

.spx-bill-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Real SPX Portal Mode Bar, Cascading Address & Fee Check */
.pos-spx-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-main);
  flex-shrink: 0;
}

.pos-spx-mode-bar.is-live {
  background: rgba(21, 128, 61, 0.08);
  border-color: rgba(21, 128, 61, 0.35);
  color: #166534;
}

.pos-spx-mode-bar.is-draft {
  background: rgba(234, 88, 12, 0.06);
  border-color: rgba(194, 65, 12, 0.3);
  color: #9a3412;
}

.pos-addr-cascade {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  padding: 7px 8px;
}

.pos-addr-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.pos-addr-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pos-select-compact {
  width: auto;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
}

.pos-cascade-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pos-cascade-grid .pos-select:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.pos-addr-resolve-badge {
  margin-top: 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-green);
}

.pos-addr-resolve-badge.is-warn {
  color: var(--accent-orange);
}

.pos-spx-fee-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 4px 0 6px;
}

.btn-spx-fee {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-spx-fee:hover {
  background: var(--bg-card);
  border-color: var(--primary);
}

.btn-spx-fee:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pos-spx-fee-result {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  line-height: 1.3;
}

.pos-spx-fee-result.is-ok {
  color: var(--accent-green);
}

.pos-spx-fee-result.is-err {
  color: var(--accent-red);
}

.btn-spx-danger {
  padding: 0 10px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid rgba(185, 28, 28, 0.35);
  background: rgba(185, 28, 28, 0.08);
  color: var(--accent-red);
  font-family: var(--font-family);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.btn-spx-danger:hover {
  background: var(--accent-red);
  color: #ffffff;
}

.crm-order-badge-live,
.crm-order-badge-draft {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  vertical-align: middle;
}

.crm-order-badge-live {
  background: rgba(21, 128, 61, 0.14);
  color: #166534;
  border: 1px solid rgba(21, 128, 61, 0.35);
}

.crm-order-badge-draft {
  background: rgba(234, 88, 12, 0.12);
  color: #9a3412;
  border: 1px solid rgba(194, 65, 12, 0.3);
}

/* ==============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================== */
@media (max-width: 1280px) {
  .inbox-container {
    grid-template-columns: 310px minmax(320px, 1fr) 310px;
  }
}

@media (max-width: 1024px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  header.rin-header,
  main.rin-main,
  footer.rin-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .rin-card-shell {
    overflow: visible;
  }

  .inbox-container {
    grid-template-columns: 1fr;
    grid-template-rows: 240px 420px auto;
  }

  .sim-input-row,
  .inline-input-row {
    flex-wrap: wrap;
  }

  .conn-grid,
  .extract-grid,
  .templates-grid {
    grid-template-columns: 1fr;
  }

  footer.rin-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-logo {
    align-self: flex-end;
    height: 50px;
  }
}

.auth-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(244, 241, 234, 0.96);
  backdrop-filter: blur(8px);
}

.auth-lock-overlay.is-hidden {
  display: none;
}

.auth-lock-card {
  width: 100%;
  max-width: 360px;
  background: #ffffff;
  border: 1px solid #e5e0d5;
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 12px 36px rgba(28, 25, 23, 0.08);
}

.auth-lock-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin: 0 auto 10px;
  display: block;
}

.auth-lock-card h2 {
  font-size: 18px;
  margin: 0 0 6px;
  color: #1c1917;
}

.auth-lock-card p {
  font-size: 13px;
  color: #78716c;
  margin: 0 0 18px;
}

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

.auth-pin-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #d6d0c4;
  border-radius: 10px;
  font-size: 16px;
  text-align: center;
  letter-spacing: 3px;
  outline: none;
  background: #faf8f5;
  color: #1c1917;
}

.auth-pin-input:focus {
  border-color: #1c1917;
  background: #ffffff;
}

.auth-login-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #1c1917;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.auth-login-btn:hover {
  opacity: 0.9;
}

.auth-login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-error-msg {
  min-height: 18px;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #dc2626;
}


/* --- UNREPLIED IG & THREADS COMMENTS TAB --- */
.nav-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.nav-count-badge.hidden {
  display: none !important;
}

.comments-view {
  height: 100%;
  overflow-y: auto;
  padding: 20px 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comments-sync-info {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border-subtle, #e7dfd5);
  padding: 6px 12px;
  border-radius: 999px;
}

.comments-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #ece3d8;
  border-radius: 14px;
  padding: 10px 14px;
}

.comments-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.comments-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cmt-pill {
  border: 1px solid #e5dcd0;
  background: #faf6f0;
  color: #4b4237;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.cmt-pill span {
  background: rgba(0, 0, 0, 0.07);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
}

.cmt-pill.active {
  background: #1f1b16;
  color: #ffffff;
  border-color: #1f1b16;
}

.cmt-pill.active span {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.comments-search-input {
  min-width: 240px;
  padding: 7px 12px;
  border: 1px solid #e2d8cb;
  border-radius: 999px;
  font-size: 12.5px;
  background: #fdfaf6;
  color: #262018;
  outline: none;
}

.comments-search-input:focus {
  border-color: #1f1b16;
  background: #ffffff;
}

.comments-errors-banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12.5px;
}

.comments-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 14px;
}

.comments-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  background: #ffffff;
  border: 1px dashed #dfd5c7;
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.comment-card {
  background: #ffffff;
  border: 1px solid #ebe2d6;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: 0 2px 8px rgba(34, 24, 12, 0.03);
}

.comment-card.is-replied {
  opacity: 0.9;
  border-color: #d1fae5;
  background: #fcfffd;
}

.comment-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comment-author-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.comment-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: #efe7dc;
  flex-shrink: 0;
}

.comment-avatar-fallback {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e9dfd1;
  color: #4a3f33;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.comment-author-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.comment-author-name {
  font-weight: 700;
  font-size: 13.5px;
  color: #1d1914;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comment-time {
  font-size: 11.5px;
  color: #7c7265;
}

.comment-platform-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.comment-platform-badge.instagram {
  background: linear-gradient(135deg, #fdf2f8, #fce7f3);
  color: #be185d;
  border: 1px solid #fbcfe8;
}

.comment-platform-badge.threads {
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #d1d5db;
}

.comment-post-context {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #faf6f0;
  border: 1px solid #ede4d8;
  border-radius: 12px;
  padding: 8px 10px;
}

.comment-post-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #e9dfd1;
  flex-shrink: 0;
}

.comment-post-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.comment-post-caption {
  font-size: 12px;
  color: #4f463c;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.comment-post-link {
  font-size: 11.5px;
  font-weight: 600;
  color: #0f62fe;
  text-decoration: none;
}

.comment-post-link:hover {
  text-decoration: underline;
}

.comment-bubble {
  background: #f5efe6;
  border-left: 3px solid #1f1b16;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #1e1914;
  word-break: break-word;
}

.comment-intent-tag {
  display: inline-block;
  margin-top: 5px;
  font-size: 11px;
  color: #6b5f52;
  background: rgba(255, 255, 255, 0.8);
  padding: 2px 7px;
  border-radius: 999px;
}

.comment-reply-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-reply-input {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  border: 1px solid #dfd5c8;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: #1f1b16;
  background: #fffdfb;
  outline: none;
}

.comment-reply-input:focus {
  border-color: #1f1b16;
  background: #ffffff;
}

.comment-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.comment-btn {
  border: 1px solid #dcd1c4;
  background: #faf6f0;
  color: #2b241d;
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.comment-btn:hover:not(:disabled) {
  background: #efe7db;
}

.comment-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.comment-btn-send {
  background: #1f1b16;
  color: #ffffff;
  border-color: #1f1b16;
  margin-left: auto;
}

.comment-btn-send:hover:not(:disabled) {
  background: #362f26;
}

.comment-replied-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12.5px;
  color: #065f46;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (max-width: 768px) {
  .comments-view {
    padding: 12px;
  }
  .comments-list {
    grid-template-columns: 1fr;
  }
  .comments-search-input {
    width: 100%;
    min-width: 0;
  }
}


.comments-batch-bar {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comments-batch-bar.hidden {
  display: none !important;
}

.comments-batch-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #78350f;
}

.comments-batch-progress-track {
  width: 100%;
  height: 7px;
  background: #fef3c7;
  border-radius: 999px;
  overflow: hidden;
}

.comments-batch-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #16a34a);
  transition: width 0.25s ease;
}


/* ==============================================================================
   MOBILE OPTIMIZATION (<= 768px) — DESKTOP (> 768px) UNCHANGED
   ============================================================================== */
.mobile-only-btn {
  display: none !important;
}

@media (max-width: 768px) {
  .mobile-only-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  html,
  body {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  header.rin-header {
    padding: 8px 12px;
    gap: 8px;
  }

  .brand-logo {
    height: 30px;
  }

  .brand-subtitle,
  .header-hint {
    display: none;
  }

  .status-badge {
    padding: 4px 9px;
    font-size: 11px;
  }

  main.rin-main {
    padding: 6px 8px 8px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .tabs-header-row {
    gap: 6px;
    margin-bottom: 6px;
    flex-shrink: 0;
  }

  .nav-tabs {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 5px;
    padding-bottom: 2px;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tab {
    flex-shrink: 0;
    padding: 7px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .btn-toggle-sim {
    flex-shrink: 0;
    padding: 6px 9px;
    font-size: 11.5px;
  }

  .rin-card-shell {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
  }

  .tab-pane.active {
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }

  #inbox-tab.tab-pane.active {
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .inbox-container {
    display: block;
    flex: 1;
    min-height: 0;
    height: 100%;
    position: relative;
  }

  /* Mobile Master-Detail: show conversation list by default */
  .inbox-sidebar {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: none;
  }

  .chat-panel {
    display: none;
    width: 100%;
    height: 100%;
  }

  .ai-inspector {
    display: none;
  }

  /* When a conversation is selected on mobile -> full-screen chat */
  #inbox-tab.mobile-chat-open .inbox-sidebar {
    display: none;
  }

  #inbox-tab.mobile-chat-open .chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  /* When POS/CRM/AI drawer is opened on mobile */
  #inbox-tab.mobile-inspector-open .ai-inspector {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 950;
    width: 100%;
    height: 100dvh;
    background: var(--bg-panel, #f5f2eb);
    overflow-y: auto;
    padding: 0 10px 28px;
  }

  .mobile-inspector-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-panel, #f5f2eb);
    padding: 10px 4px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 13.5px;
    margin-bottom: 8px;
  }

  .chat-header {
    padding: 8px 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .chat-header-info {
    gap: 8px;
  }

  .chat-header-actions {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .chat-header-actions::-webkit-scrollbar {
    display: none;
  }

  .messages-container {
    padding: 10px;
  }

  .message-bubble {
    max-width: 88%;
    font-size: 14px;
  }

  .chat-input-bar {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 6px;
  }

  /* Prevent iOS Safari auto-zoom on input focus */
  input[type="text"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="datetime-local"],
  textarea,
  select {
    font-size: 16px !important;
  }

  .pos-money-input {
    padding-right: 24px;
  }

  .pos-money-unit {
    right: 9px;
    font-size: 15px;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .section-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .comments-view,
  .templates-view,
  .settings-view,
  .webhooks-view,
  .zalo-poster-view {
    padding: 12px 10px 28px;
  }

  .zp-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .zp-card {
    padding: 13px 12px;
  }

  .zp-presets-grid {
    grid-template-columns: 1fr !important;
  }

  .zp-submit-row {
    flex-direction: column;
  }

  .zp-submit-row .zp-btn-lg {
    width: 100%;
    min-height: 44px;
  }

  .zp-time-row {
    flex-direction: column;
    align-items: stretch;
  }

  .zp-preset-btn {
    min-height: 44px;
  }

  .zp-group-chip {
    min-height: 36px;
    padding: 6px 11px;
    font-size: 13px;
  }

  .comments-toolbar {
    padding: 8px 10px;
  }

  .comments-toolbar-right {
    width: 100%;
  }

  .comment-btn {
    min-height: 36px;
  }

  footer.rin-footer {
    display: none;
  }
}

/* =====================================================================
   ZALO GROUP AUTO-MIRROR, QUICK BROADCAST & SCHEDULED POSTER
   ===================================================================== */
.nav-badge-green {
  background: #10b981 !important;
  color: #ffffff !important;
  font-size: 9.5px;
  letter-spacing: 0.3px;
}

.zalo-poster-view {
  padding: 18px 20px 28px;
  overflow-y: auto;
  height: 100%;
  box-sizing: border-box;
}

.zp-conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.zp-conn-pill.ok {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.38);
  color: #047857;
}

.zp-conn-pill.err {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
  color: #b91c1c;
}

.zp-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.zp-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.zp-card {
  background: var(--bg-panel, #efede8);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 15px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.zp-card-hero {
  border-color: rgba(16, 185, 129, 0.35);
}

.zp-card-vault {
  border-color: rgba(59, 130, 246, 0.32);
}

.zp-card-tg {
  border-color: rgba(14, 165, 233, 0.42);
}

.zp-tg-token-row {
  display: flex;
  gap: 7px;
  align-items: center;
}

.zp-tg-token-row .form-input {
  flex: 1;
}

.zp-tg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .zp-tg-token-row {
    flex-direction: column;
    align-items: stretch;
  }
}

.zp-vault-cheatsheet {
  background: var(--bg-input, #f7f5f0);
  border: 1px solid var(--border-color);
  border-radius: 9px;
  padding: 10px 11px;
}

.zp-vault-cs-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.zp-vault-cs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 10px;
  font-size: 11.5px;
  color: var(--text-main);
  line-height: 1.45;
}

.zp-vault-cs-grid code {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #1d4ed8;
}

.zp-vault-cs-note {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed var(--border-color);
  font-size: 11.2px;
  color: var(--text-muted);
  line-height: 1.45;
}

@media (max-width: 768px) {
  .zp-vault-cs-grid {
    grid-template-columns: 1fr;
  }
}

.zp-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.zp-card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

.zp-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.45;
}

/* Toggle Switch */
.zp-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.zp-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.zp-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #b8b3a8;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.zp-switch-slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.zp-switch input:checked + .zp-switch-slider {
  background: #10b981;
}

.zp-switch input:checked + .zp-switch-slider::before {
  transform: translateX(22px);
}

.zp-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  margin-bottom: 12px;
}

.zp-status-bar.is-on {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.38);
  color: #065f46;
}

.zp-status-bar .zp-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9ca3af;
  flex-shrink: 0;
}

.zp-status-bar.is-on .zp-dot {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.zp-flow-box {
  background: var(--bg-input, #f7f5f0);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 11px 12px;
  margin-bottom: 10px;
}

.zp-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.zp-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.zp-group-chip input {
  accent-color: #10b981;
  margin: 0;
}

.zp-group-chip.selected {
  background: rgba(16, 185, 129, 0.13);
  border-color: rgba(16, 185, 129, 0.5);
  color: #065f46;
}

.zp-options-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.zp-check-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.zp-check-pill input {
  accent-color: var(--primary);
}

.zp-delay-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-muted);
}

.zp-mini-select {
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
}

.zp-tip {
  font-size: 11.8px;
  color: var(--text-muted);
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
}

.zp-recent-details {
  margin-top: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 9px;
  padding: 8px 10px;
}

.zp-recent-details summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  user-select: none;
}

.zp-recent-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 9px;
  max-height: 280px;
  overflow-y: auto;
}

.zp-recent-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.zp-recent-thumb {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #e5e2db;
}

.zp-recent-body {
  flex: 1;
  min-width: 0;
}

.zp-recent-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zp-recent-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Quick Presets */
.zp-presets-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.zp-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.zp-preset-btn:hover {
  border-color: var(--primary);
  background: #faf9f6;
}

.zp-preset-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.zp-preset-label {
  font-size: 12.5px;
  font-weight: 800;
}

.zp-preset-preview {
  font-size: 11px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
}

.zp-preset-editor {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 9px;
  padding: 10px;
  margin-bottom: 10px;
}

.zp-preset-editor-rows {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 8px;
}

.zp-preset-edit-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 28px;
  gap: 6px;
  align-items: center;
}

.zp-preset-editor-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.zp-quick-custom-row {
  display: flex;
  gap: 7px;
}

.zp-quick-custom-row .form-input {
  flex: 1;
}

/* Upload & Schedule */
.zp-upload-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px;
  border: 1.5px dashed #b8b3a8;
  border-radius: 10px;
  background: var(--bg-input);
  margin-bottom: 10px;
}

.zp-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.zp-upload-btn:hover {
  opacity: 0.92;
}

.zp-upload-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.zp-media-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.zp-media-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #1d1d1f;
}

.zp-media-tile img,
.zp-media-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.zp-media-badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

.zp-media-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.72);
  color: #ffffff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zp-time-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 11px;
  margin-bottom: 11px;
}

.zp-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.zp-datetime-input {
  flex: 1;
  min-width: 185px;
}

.zp-time-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.zp-time-chip {
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.zp-time-chip:hover {
  border-color: var(--primary);
  background: #f5f3ee;
}

.zp-submit-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.zp-btn-lg {
  flex: 1;
  min-height: 40px;
  font-weight: 700;
}

/* Queue & History */
.zp-queue-section {
  border-top: 1px solid var(--border-color);
  padding-top: 11px;
}

.zp-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.zp-count-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 800;
}

.zp-scheduled-list,
.zp-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.zp-item-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 9px;
  padding: 9px 11px;
}

.zp-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.zp-item-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  word-break: break-word;
}

.zp-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.zp-status-tag {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.zp-status-tag.scheduled {
  background: rgba(59, 130, 246, 0.14);
  color: #1d4ed8;
}

.zp-status-tag.running {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.zp-status-tag.sent {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

.zp-status-tag.partial {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.zp-status-tag.failed {
  background: rgba(239, 68, 68, 0.13);
  color: #b91c1c;
}

.zp-item-results {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.zp-res-chip {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
}

.zp-res-chip.ok {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.35);
  color: #065f46;
}

.zp-res-chip.err {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
  color: #b91c1c;
}

.zp-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.zp-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 14px 8px;
}

.btn-xs {
  padding: 4px 9px !important;
  font-size: 11.5px !important;
  min-height: 28px !important;
}


/* ==================== SPX LIVE ORDERS TAB ==================== */
.orders-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px;
  height: 100%;
  overflow-y: auto;
}

.orders-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.orders-topbar h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.orders-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 3px 0 0;
}

.orders-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.orders-conn-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.orders-conn-pill.connected {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #065f46;
}

.orders-conn-pill.disconnected {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #b91c1c;
}

.orders-kpi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.orders-kpi-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.orders-kpi-card:hover {
  border-color: #1c1917;
  transform: translateY(-1px);
}

.orders-kpi-card.active {
  background: #1c1917;
  border-color: #1c1917;
  color: #faf8f5;
  box-shadow: 0 4px 12px rgba(28, 25, 23, 0.15);
}

.orders-kpi-card.active .orders-kpi-label,
.orders-kpi-card.active strong {
  color: #faf8f5;
}

.orders-kpi-card.kpi-money {
  cursor: default;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #fed7aa;
}

.orders-kpi-card.kpi-money:hover {
  transform: none;
  border-color: #fed7aa;
}

.orders-kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.orders-kpi-card strong {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.orders-kpi-sub {
  font-size: 10.5px;
  color: #9a3412;
  font-weight: 600;
}

.orders-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.orders-search-input {
  flex: 1;
  max-width: 520px;
}

.orders-count-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.orders-list-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 24px;
}

.spx-order-row-card {
  background: #ffffff;
  border: 1.5px solid #bfb8ab;
  border-left: 4.5px solid #d97706;
  border-radius: 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  box-shadow: 0 2px 0 rgba(28, 25, 23, 0.08), 0 6px 16px rgba(28, 25, 23, 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.spx-order-row-card:nth-child(even) {
  background: #faf8f4;
}

.spx-order-row-card.order-status-pending_pickup {
  border-left-color: #d97706;
}
.spx-order-row-card.order-status-in_transit {
  border-left-color: #2563eb;
}
.spx-order-row-card.order-status-delivered {
  border-left-color: #059669;
}
.spx-order-row-card.order-status-returning {
  border-left-color: #ea580c;
}
.spx-order-row-card.order-status-cancelled {
  border-left-color: #dc2626;
}

.spx-order-row-card:hover {
  border-color: #8c8577;
  box-shadow: 0 3px 0 rgba(28, 25, 23, 0.12), 0 8px 20px rgba(28, 25, 23, 0.08);
}

.spx-order-row-card.is-cancelled {
  opacity: 0.78;
  background: #f5f3ef;
}

.spx-order-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 15px;
  background: #f1eee7;
  border-bottom: 1px solid #dcd6ca;
}

.spx-order-id-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spx-order-code-pill {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 800;
  color: #c2410c;
  background: #fff7ed;
  border: 1px solid #fdba74;
  padding: 3px 8px;
  border-radius: 7px;
  cursor: pointer;
}

.spx-order-code-pill:hover {
  background: #ffedd5;
}

.spx-order-dh-tag {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid #cfc9bc;
  padding: 3px 7px;
  border-radius: 6px;
}

.spx-order-dh-tag.is-rin-order-id {
  background: #1c1917;
  color: #fafaf9;
  border-color: #1c1917;
  font-family: var(--font-mono);
  letter-spacing: 0.2px;
}

.spx-order-time-tag {
  font-size: 11.5px;
  color: var(--text-muted);
}

.spx-status-badge {
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.spx-status-badge.status-pending_pickup {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.spx-status-badge.status-in_transit {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.spx-status-badge.status-delivered {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.spx-status-badge.status-returning {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.spx-status-badge.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.spx-order-row-body {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1.3fr;
  gap: 14px;
  align-items: start;
  padding: 12px 15px 10px;
}

.spx-order-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.spx-order-customer {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-primary);
}

.spx-order-meta {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}

.spx-order-cod {
  font-size: 13.5px;
  font-weight: 800;
  color: #b45309;
}

.spx-order-cod.is-cod-zero {
  color: #047857;
}

.spx-order-milestone {
  background: #f3f0e8;
  border: 1px solid #d5cfc2;
  border-left: 3px solid #78716c;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 11.8px;
  line-height: 1.45;
  color: var(--text-primary);
}

.spx-order-milestone-time {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.spx-order-row-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 15px 10px;
  background: #f7f5f0;
  border-top: 1px dashed #d5cfc2;
}

.spx-order-row-footer .btn-secondary {
  background: #ffffff;
  border: 1px solid #b8b1a3;
}

.spx-order-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.spx-timeline-drawer {
  background: #f3f0e8;
  border: 1px solid #d5cfc2;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 15px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spx-timeline-step {
  display: flex;
  gap: 10px;
  font-size: 12px;
  align-items: flex-start;
}

.spx-timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a8a29e;
  margin-top: 5px;
  flex-shrink: 0;
}

.spx-timeline-step:first-child .spx-timeline-dot {
  background: #ea580c;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2);
}

@media (max-width: 1100px) {
  .orders-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .spx-order-row-body {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .orders-view {
    padding: 12px;
  }
  .orders-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .spx-order-row-body {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}


/* SPX Coin Redemption Row in POS (compact 1-line) */
.pos-spx-coin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 8px;
  min-height: 28px;
  border-radius: 7px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  margin-bottom: 6px;
  flex-wrap: nowrap;
}

.pos-spx-coin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: #92400e;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.pos-spx-coin-toggle input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: #d97706;
  cursor: pointer;
  flex-shrink: 0;
}

.pos-spx-coin-badge {
  font-size: 11px;
  font-weight: 700;
  color: #b45309;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #fbbf24;
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* Incoming realtime customer message highlight pulse */
@keyframes convJustArrivedPulse {
  0% {
    background-color: #fef3c7;
    box-shadow: inset 3px 0 0 #ea580c, 0 0 0 2px rgba(234, 88, 12, 0.35);
  }
  65% {
    background-color: #fffbeb;
    box-shadow: inset 3px 0 0 #f97316, 0 0 0 1px rgba(249, 115, 22, 0.2);
  }
  100% {
    background-color: inherit;
    box-shadow: none;
  }
}

.conv-item.is-just-arrived {
  animation: convJustArrivedPulse 3.6s ease-out;
}


/* Two-Tier Primary Navigation + Contextual Inbox Filter Toolbar */
.tabs-header-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.nav-tabs {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 3px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tabs-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

.nav-tab {
  padding: 6px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 12.2px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-tab-util:not(.active) {
  opacity: 0.85;
}

.nav-tab-util:not(.active):hover {
  opacity: 1;
}

.top-inbox-filters-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  background: #edeae3;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 6px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-inbox-filters-bar::-webkit-scrollbar {
  display: none;
}

.top-inbox-filters-bar.is-hidden {
  display: none !important;
}

.top-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.top-filter-caption {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-right: 2px;
  user-select: none;
}

.top-filter-sep {
  width: 1px;
  height: 22px;
  background: var(--border-color);
  flex-shrink: 0;
}

.top-inbox-filters-bar .filter-btn,
.top-inbox-filters-bar .status-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.top-inbox-filters-bar .filter-btn:hover,
.top-inbox-filters-bar .status-filter-btn:hover {
  background: rgba(255, 255, 255, 0.72);
}

.top-inbox-filters-bar .filter-btn.is-zero:not(.active),
.top-inbox-filters-bar .status-filter-btn.is-zero:not(.active) {
  opacity: 0.76;
}

.top-inbox-filters-bar .filter-btn.active,
.top-inbox-filters-bar .status-filter-btn.active {
  background: #ffffff;
  color: #1c1917;
  border-color: #1c1917;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.1);
}

.f-pill-cnt {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(28, 25, 23, 0.08);
  color: var(--text-secondary);
  line-height: 1.35;
}

.f-pill-cnt.is-alert {
  background: #fef3c7;
  color: #b45309;
}

.f-pill-cnt.is-warn {
  background: #e0e7ff;
  color: #3730a3;
}

.top-inbox-filters-bar .filter-btn.active .f-pill-cnt,
.top-inbox-filters-bar .status-filter-btn.active .f-pill-cnt {
  background: #1c1917;
  color: #ffffff;
}

@media (max-width: 768px) {
  .nav-tabs-spacer,
  .top-filter-caption {
    display: none;
  }
  .top-inbox-filters-bar {
    gap: 6px;
    padding: 4px 7px;
  }
  .top-inbox-filters-bar .filter-btn,
  .top-inbox-filters-bar .status-filter-btn {
    padding: 5px 9px;
    font-size: 12.5px;
    gap: 5px;
  }
}


/* ==============================================================================
   ZALO-STYLE LEFT ICON RAIL & FULL-VIEWPORT WORKSPACE (WARM-STONE PALETTE)
   ============================================================================== */
.zalo-app-shell {
  display: flex;
  flex: 1;
  width: 100%;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-primary);
}

.zalo-left-rail {
  width: 56px;
  flex-shrink: 0;
  height: 100%;
  background: #2e2a29;
  border-right: 1px solid #23201f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  z-index: 80;
  user-select: none;
}

.zalo-rail-top,
.zalo-rail-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.zalo-rail-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 11px;
  background: #e4e2dd;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.zalo-rail-avatar:hover {
  transform: scale(1.03);
  border-color: #ffffff;
}

.zalo-rail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 9.5px;
  image-rendering: -webkit-optimize-contrast;
  display: block;
}

.rail-live-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #34d399;
  border: 2px solid #2e2a29;
}

.rail-live-dot.offline {
  background: #ef4444;
}

.zalo-rail-divider {
  width: 26px;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
  margin: 2px 0;
}

.zalo-left-rail .nav-tab,
.zalo-left-rail .zalo-rail-btn {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #fafaf9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.zalo-left-rail .rail-ico {
  font-size: 18px;
  line-height: 1;
}

.zalo-left-rail .nav-tab:hover:not(.active),
.zalo-left-rail .zalo-rail-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.12);
}

.zalo-left-rail .nav-tab.active {
  background: rgba(247, 245, 240, 0.18);
  border-color: rgba(247, 245, 240, 0.28);
  color: #faf8f4;
  box-shadow: inset 3px 0 0 #f6e8c8, 0 2px 6px rgba(0, 0, 0, 0.22);
}

.zalo-left-rail .nav-tab-util:not(.active) {
  opacity: 0.78;
}

.zalo-left-rail .nav-tab-util:not(.active):hover {
  opacity: 1;
}

.zalo-left-rail .live-auto-btn.active {
  background: var(--accent-green);
  color: #ffffff;
  border-color: var(--accent-green);
  box-shadow: 0 2px 6px rgba(21, 128, 61, 0.25);
}

.zalo-left-rail .nav-count-badge {
  position: absolute;
  top: -3px;
  right: -4px;
  margin: 0;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  font-size: 9.5px;
  font-weight: 800;
  border: 1.5px solid #2e2a29;
  pointer-events: none;
}

.zalo-left-rail .nav-badge-green {
  font-size: 8.5px;
  padding: 0 3.5px;
}

@media (min-width: 769px) {
  .zalo-left-rail [data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1c1917;
    color: #ffffff;
    font-family: var(--font-family);
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 7px;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    z-index: 3000;
  }
}

/* Maximized Edge-to-Edge Main Workspace */
main.rin-main {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-inbox-filters-bar {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid #292524;
  background: #383331;
  padding: 6px 10px;
  gap: 7px;
  flex-shrink: 0;
}

.top-inbox-filters-bar .top-filter-caption {
  color: rgba(250, 250, 249, 0.62);
}

.top-inbox-filters-bar .top-filter-sep {
  background: rgba(255, 255, 255, 0.18);
}

.top-inbox-filters-bar .filter-btn,
.top-inbox-filters-bar .status-filter-btn {
  color: #f5f5f4;
}

.top-inbox-filters-bar .filter-btn:hover:not(.active),
.top-inbox-filters-bar .status-filter-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.top-inbox-filters-bar .filter-btn.is-zero:not(.active),
.top-inbox-filters-bar .status-filter-btn.is-zero:not(.active) {
  opacity: 0.76;
}

.top-inbox-filters-bar .filter-btn.active,
.top-inbox-filters-bar .status-filter-btn.active {
  background: #f7f5f0;
  color: #1c1917;
  border-color: #f7f5f0;
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.top-inbox-filters-bar .f-pill-cnt {
  background: rgba(255, 255, 255, 0.16);
  color: #fafaf9;
}

.top-inbox-filters-bar .f-pill-cnt.is-alert {
  background: #f6e8c8;
  color: #78350f;
}

.top-inbox-filters-bar .f-pill-cnt.is-warn {
  background: #e0e7ff;
  color: #312e81;
}

.top-inbox-filters-bar .filter-btn.active .f-pill-cnt,
.top-inbox-filters-bar .status-filter-btn.active .f-pill-cnt {
  background: #383331;
  color: #faf8f4;
}

.top-bar-status-cluster {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.top-bar-status-cluster .ch-chip {
  padding: 3px 7px;
  font-size: 10.5px;
  background: var(--bg-input);
}

.top-bar-status-cluster .status-badge {
  padding: 3px 8px;
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #86efac;
}

.top-bar-status-cluster .status-badge.offline {
  color: #fca5a5;
}

.top-bar-status-cluster .status-badge .status-dot {
  background: #34d399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.45);
}

.top-bar-status-cluster .status-badge.offline .status-dot {
  background: #ef4444;
  box-shadow: none;
}

.rin-card-shell {
  flex: 1;
  min-height: 0;
  border: none;
  border-radius: 0;
  background: var(--bg-card);
}

#inbox-tab {
  padding: 0;
  gap: 0;
}

.simulator-topbar {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}

.inbox-container {
  grid-template-columns: 300px minmax(360px, 1fr) 320px;
  gap: 0;
}

.inbox-container.right-collapsed {
  grid-template-columns: 300px minmax(360px, 1fr);
}

.inbox-container.right-collapsed .ai-inspector {
  display: none;
}

.inbox-sidebar {
  border: none;
  border-right: 1px solid #2c2826;
  border-radius: 0;
  background: #eae6de;
}

.sidebar-header {
  padding: 10px 12px;
  background: #e4dfd6;
  border-bottom: 1px solid #d5d0c5;
}

.sidebar-header h2 {
  margin-bottom: 7px;
}

.conv-search {
  margin-bottom: 0;
  height: 33px;
  background: #f8f6f1;
  border-color: #cfc9bd;
}

.conv-search:focus {
  background: #ffffff;
  border-color: #383331;
}

.conv-item {
  padding: 10px 12px;
  border-bottom: 1px solid #dcd7cc;
}

.conv-item:hover {
  background: #e2ddd3;
}

.conv-item.is-unreplied {
  border-left: 3.5px solid #d97706;
}

.conv-item.active {
  background: #f8f6f1;
  border-left: 3.5px solid #383331;
}

.chat-window {
  border: none;
  border-radius: 0;
  background: #322e2c;
  color: #f7f5f0;
}

.chat-header {
  background: #3e3937;
  border-bottom: 1px solid #292524;
  padding: 8px 14px;
}

.chat-window .chat-header-title {
  color: #fafaf9;
}

.chat-window .chat-header-sub {
  color: rgba(250, 250, 249, 0.68);
}

#chat-header-avatar {
  background: #292524;
  border-color: rgba(255, 255, 255, 0.22);
  color: #fafaf9;
}

.chat-header .btn-mini {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.2);
  color: #f5f5f4;
}

.chat-header .btn-mini:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.chat-window .messages-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
}

.chat-window .messages-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.36);
}

.chat-window .message-customer .message-bubble {
  background: #f6e8c8;
  color: #231f1e;
  border: 1px solid #e2cb99;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.chat-window .message-bot .message-bubble,
.chat-window .message-bot.admin-reply .message-bubble {
  background: #faf8f4;
  color: #1c1917;
  border: 1px solid #e4dfd5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.chat-window .message-meta {
  color: rgba(247, 245, 240, 0.66);
}

.chat-window .ai-tag {
  color: #86efac;
}

.chat-window .msg-img {
  border-color: rgba(255, 255, 255, 0.16);
}

.chat-window .message-customer .msg-link-card {
  background: #fbf3df;
  border-color: #dec48d;
  color: #231f1e;
}

.chat-window .message-bot .msg-link-card {
  background: #efeae0;
  border-color: #dad4c8;
  color: #1c1917;
}

.chat-window .msg-inline-link {
  color: #1d4ed8;
}

.chat-window .message-bot .msg-inline-link {
  color: #1d4ed8;
}

.chat-window .chat-phone-chip {
  background: rgba(234, 88, 12, 0.14);
  color: #9a3412;
  border-color: rgba(234, 88, 12, 0.35);
}

.chat-window .message-bot .chat-phone-chip {
  background: rgba(234, 88, 12, 0.14);
  color: #9a3412;
  border-color: rgba(234, 88, 12, 0.35);
}

.chat-window .chat-phone-chip:hover,
.chat-window .message-bot .chat-phone-chip:hover {
  background: #ea580c;
  color: #ffffff;
  border-color: #ea580c;
}

.chat-window .msg-date-divider,
.chat-window .history-day1-divider {
  background: rgba(0, 0, 0, 0.34);
  border-color: rgba(255, 255, 255, 0.14);
  color: #e7e5e4;
}

.chat-window .history-loader-bar {
  background: #3d3837;
  border-color: rgba(255, 255, 255, 0.16);
}

.chat-window .history-loader-info {
  color: #e7e5e4;
}

.chat-window .btn-history-more,
.chat-window .btn-accept-only,
.chat-window .btn-edit {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fafaf9;
}

.chat-window .btn-history-more:hover:not(:disabled),
.chat-window .btn-accept-only:hover:not(:disabled),
.chat-window .btn-edit:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chat-window .btn-history-all,
.chat-window .btn-accept-reply {
  background: #fafaf9;
  border-color: #fafaf9;
  color: #1c1917;
}

.chat-window .request-folder-banner {
  background: #3f3a38;
  border-color: rgba(255, 255, 255, 0.16);
  border-left: 4px solid #fbbf24;
  color: #fafaf9;
}

.chat-window .request-folder-banner.is-hidden {
  border-left-color: #c084fc;
}

.chat-window .copilot-review-box {
  background: #3d3837;
  border-color: #fbbf24;
}

.chat-window .copilot-title {
  color: #fcd34d;
}

.chat-window .copilot-text {
  background: #262322;
  border-color: rgba(255, 255, 255, 0.16);
  color: #fafaf9;
}

.chat-pending-media-bar {
  background: #353130;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: #fafaf9;
}

.chat-window .quick-reply-popover {
  background: #3b3634;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
}

.chat-window .qr-popover-header {
  background: #322e2c;
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.chat-window .qr-popover-header input {
  background: #262322;
  border-color: rgba(255, 255, 255, 0.18);
  color: #f7f5f0;
}

.chat-window .qr-popover-header .close-btn {
  color: rgba(247, 245, 240, 0.7);
}

.chat-window .qr-popover-item {
  background: #2d2928;
  border-color: rgba(255, 255, 255, 0.1);
}

.chat-window .qr-popover-item:hover {
  background: #453f3d;
}

.chat-window .qr-popover-item-head {
  color: #f7f5f0;
}

.chat-window .qr-popover-item-preview {
  color: rgba(247, 245, 240, 0.68);
}

.chat-window .shortcut-badge {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  color: #f6e8c8;
}

.chat-input-bar {
  background: #3e3937;
  border-top: 1px solid #292524;
  padding: 9px 12px;
}

.chat-input-bar .btn-mini {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fafaf9;
}

.chat-input-bar .btn-mini:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.chat-input-field {
  background: #262322;
  border-color: rgba(255, 255, 255, 0.2);
  color: #fafaf9;
}

.chat-input-field::placeholder {
  color: rgba(250, 250, 249, 0.48);
}

.chat-input-field:focus {
  background: #1f1c1b;
  border-color: rgba(255, 255, 255, 0.45);
}

.chat-input-bar .btn-primary {
  background: #f7f5f0;
  color: #1c1917;
}

.chat-input-bar .btn-primary:hover:not(:disabled) {
  background: #eae6de;
}

.ai-inspector {
  border: none;
  border-left: 1px solid #2c2826;
  border-radius: 0;
  background: #eae6de;
  padding: 8px 10px;
}

.ai-inspector .right-panel-tabs {
  background: #dfd9ce;
  border-color: #cfc9bd;
}

.ai-inspector .right-tab-btn.active {
  background: #383331;
  color: #faf8f4;
}

.ai-inspector .inspector-card {
  background: #f5f2eb;
  border-color: #d8d2c6;
}

.ai-inspector .pos-addr-cascade,
.ai-inspector .pos-total-bar,
.ai-inspector .ai-qr-item,
.ai-inspector .crm-order-item,
.ai-inspector .crm-note-item {
  background: #faf8f4;
  border-color: #dcd6ca;
}

.ai-inspector .pos-input,
.ai-inspector .pos-textarea,
.ai-inspector .pos-select {
  background: #fcfbf8;
  border-color: #d4cfc3;
}

.ai-inspector .pos-input:focus,
.ai-inspector .pos-textarea:focus,
.ai-inspector .pos-select:focus {
  background: #ffffff;
  border-color: #383331;
}

#btn-toggle-right-pane {
  padding: 5px 8px;
  font-size: 13px;
  line-height: 1;
}

#btn-toggle-right-pane.active {
  background: #f7f5f0;
  color: #1c1917;
  border-color: #f7f5f0;
}

@media (max-width: 1200px) and (min-width: 769px) {
  .inbox-container {
    grid-template-columns: 260px minmax(280px, 1fr) 285px;
  }
  .inbox-container.right-collapsed {
    grid-template-columns: 260px minmax(280px, 1fr);
  }
  .top-bar-status-cluster .ch-chip {
    display: none;
  }
}

@media (max-width: 1024px) and (min-width: 769px) {
  body {
    height: 100vh;
    overflow: hidden;
  }
  main.rin-main {
    padding: 0;
  }
  .rin-card-shell {
    overflow: hidden;
  }
  .inbox-container {
    grid-template-columns: 250px minmax(260px, 1fr) 275px;
    grid-template-rows: none;
  }
  .inbox-container.right-collapsed {
    grid-template-columns: 250px minmax(260px, 1fr);
  }
}

@media (max-width: 768px) {
  .desktop-only-btn,
  .top-bar-status-cluster,
  .zalo-rail-divider {
    display: none !important;
  }

  .zalo-app-shell {
    flex-direction: column;
    height: 100dvh;
  }

  .zalo-left-rail {
    width: 100%;
    height: 46px;
    flex-direction: row;
    justify-content: space-between;
    padding: 4px 8px;
    border-right: none;
    border-bottom: 1px solid #23201f;
    overflow-x: auto;
    gap: 4px;
    scrollbar-width: none;
  }

  .zalo-left-rail .nav-tab.active {
    box-shadow: inset 0 -2.5px 0 #f6e8c8;
  }

  .zalo-left-rail::-webkit-scrollbar {
    display: none;
  }

  .zalo-rail-top,
  .zalo-rail-bottom {
    flex-direction: row;
    width: auto;
    gap: 4px;
  }

  .zalo-rail-avatar {
    width: 36px;
    height: 36px;
  }

  .zalo-left-rail .nav-tab,
  .zalo-left-rail .zalo-rail-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .zalo-left-rail .rail-ico {
    font-size: 16px;
  }

  main.rin-main {
    padding: 0;
  }

  .rin-card-shell {
    border-radius: 0;
  }
}


/* ==============================================================================
   RETRO TYPEWRITER TYPOGRAPHY (IBM Plex Mono Across Entire UI)
   ============================================================================== */
.conv-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.conv-item.is-unreplied .conv-name,
.conv-item.active .conv-name {
  font-weight: 700;
}

.conv-preview {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.42;
}

.conv-time {
  font-size: 11px;
  font-weight: 400;
}

.badge {
  font-size: 10.5px;
  font-weight: 500;
}

.chat-header-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.chat-header-sub {
  font-size: 11.5px;
  font-weight: 400;
}

.message-bubble {
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.1px;
  padding: 10px 14px;
}

.message-meta {
  font-size: 11px;
  font-weight: 400;
}

.ai-tag {
  font-size: 11px;
  font-weight: 600;
}

.chat-input-field {
  font-size: 13px;
  font-weight: 400;
  height: 40px;
}

.top-inbox-filters-bar .filter-btn,
.top-inbox-filters-bar .status-filter-btn {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0;
}

.top-inbox-filters-bar .filter-btn.active,
.top-inbox-filters-bar .status-filter-btn.active {
  font-weight: 700;
}

.f-pill-cnt {
  font-size: 12px;
  font-weight: 700;
}

.btn-mini,
.btn-secondary,
.btn-primary,
.right-tab-btn {
  font-weight: 600;
  letter-spacing: -0.15px;
}

/* ============================================================
   ZALO-IDENTICAL CLASSIFICATION BAR, POPOVERS & TAGGING UI
   ============================================================ */
.sidebar-header {
  padding: 10px 12px 0 12px;
}

.zalo-subfilter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  min-height: 32px;
}

.zalo-subtabs {
  display: flex;
  align-items: stretch;
  gap: 14px;
}

.zalo-subtab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px 7px 2px;
  border: none;
  background: transparent;
  color: #6b645c;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.14s ease;
}

.zalo-subtab:hover {
  color: #2c2523;
}

.zalo-subtab.active {
  color: #1f4e8c;
}

.zalo-subtab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: #1f4e8c;
}

.zalo-subtab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: #d97706;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
}

.zalo-subactions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 5px;
}

.zalo-classify-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #5c554e;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.zalo-classify-btn:hover {
  background: rgba(56, 51, 49, 0.08);
  color: #2c2523;
}

.zalo-classify-btn.is-open,
.zalo-classify-btn.has-active-filter {
  background: rgba(31, 78, 140, 0.14);
  border-color: rgba(31, 78, 140, 0.35);
  color: #164075;
}

.zalo-classify-cnt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: #1f4e8c;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
}

.zalo-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #6b645c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -1px;
  cursor: pointer;
}

.zalo-more-btn:hover {
  background: rgba(56, 51, 49, 0.09);
  color: #2c2523;
}

.zalo-active-filters-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 0 8px 0;
  border-top: 1px dashed #d5cfc3;
}

.zalo-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f8f6f1;
  border: 1px solid #cfc9bd;
  color: #2c2523;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}

.zalo-active-chip:hover {
  border-color: #9e9689;
  background: #ffffff;
}

.zalo-active-chip-clear {
  margin-left: auto;
  padding: 2px 7px;
  border: none;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}

.zalo-active-chip-clear:hover {
  background: rgba(220, 38, 38, 0.18);
}

/* Floating Zalo Popovers (matches Zalo PC dark popover, harmonized Espresso) */
.zalo-popover {
  position: fixed;
  width: 256px;
  max-height: 78vh;
  overflow-y: auto;
  background: #262322;
  color: #f3efe8;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.48);
  padding: 6px 0;
  z-index: 2600;
  font-size: 12.5px;
}

.zalo-pop-assign-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px 8px 14px;
}

.zalo-assign-conv-name {
  font-size: 12px;
  font-weight: 600;
  color: #f6e8c8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zalo-pop-close-x {
  border: none;
  background: transparent;
  color: #b5ada3;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.zalo-pop-close-x:hover {
  color: #ffffff;
}

.zalo-pop-section {
  padding: 4px 0;
}

.zalo-pop-title {
  padding: 5px 14px 4px 14px;
  font-size: 11px;
  font-weight: 600;
  color: #b5ada3;
}

.zalo-pop-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 14px 4px 14px;
}

.zalo-pop-clear-btn {
  border: none;
  background: transparent;
  color: #f6e8c8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.zalo-pop-clear-btn:hover {
  text-decoration: underline;
}

.zalo-pop-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border: none;
  background: transparent;
  color: #f3efe8;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.zalo-pop-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.zalo-pop-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zalo-pop-count {
  font-size: 11px;
  color: #a39b91;
  font-weight: 500;
  margin-left: auto;
}

.zalo-radio-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.8px solid #756d66;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.12s ease;
}

.zalo-pop-item.is-selected .zalo-radio-circle {
  border-color: #3b82f6;
}

.zalo-pop-item.is-selected .zalo-radio-circle::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
}

.zalo-chk-box {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.6px solid #756d66;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 700;
  color: transparent;
  transition: all 0.12s ease;
}

.zalo-pop-item.is-checked .zalo-chk-box {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
}

.zalo-tag-svg {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.zalo-pop-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 0;
}

.zalo-pop-footer-btn {
  width: 100%;
  padding: 9px 14px 7px 14px;
  border: none;
  background: transparent;
  color: #f3efe8;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.zalo-pop-footer-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Zalo Preview Pointed Tag Icons inside .conv-preview & Quick Assign Trigger */
.conv-preview-tags {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 5px;
  vertical-align: -1.5px;
  cursor: pointer;
}

.conv-quick-tag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #7c746b;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.conv-item:hover .conv-quick-tag-btn,
.conv-item.active .conv-quick-tag-btn,
.conv-quick-tag-btn.has-tags {
  opacity: 0.92;
}

.conv-quick-tag-btn:hover {
  opacity: 1;
  background: rgba(56, 51, 49, 0.12);
  color: #2c2523;
}

/* Chat Header Pointed Zalo Tags & Trigger */
.chat-header-tags {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.chat-header-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f6e8c8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.chat-header-tag-pill:hover {
  background: rgba(255, 255, 255, 0.18);
}

.chat-header-add-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px dashed rgba(255, 255, 255, 0.24);
  color: #d6cfc6;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.chat-header-add-tag-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* Tag Manager Modal */
.tag-mgr-modal-content {
  max-width: 500px;
}

.tag-mgr-form {
  background: #f7f4ee;
  border: 1px solid #d8d2c6;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.tag-mgr-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tag-mgr-form-row .form-input {
  flex: 1;
  min-width: 0;
  height: 34px;
}

.tag-mgr-colors {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tag-color-swatch:hover {
  transform: scale(1.1);
}

.tag-color-swatch.active {
  border-color: #2c2523;
  box-shadow: 0 0 0 2px #ffffff inset;
}

.tag-mgr-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 330px;
  overflow-y: auto;
}

.tag-mgr-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid #ded8cc;
  border-radius: 7px;
  background: #faf8f4;
}

.tag-mgr-row-label {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #2c2523;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-mgr-row-cnt {
  font-size: 11px;
  color: #7c746b;
}

.tag-mgr-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tag-mgr-row-actions .btn-mini {
  padding: 3px 6px;
  font-size: 11px;
}

/* ==============================================================================
   ZALO-IDENTICAL REALTIME CHAT UX (Unread, Clustering, Quote-Reply, Pill, Composer)
   Theme: Espresso (#322e2c / #332f2d) • Oat-Honey (#f6e8c8) • Milk-Ivory (#faf8f4) • Warm-Linen (#eae6de)
   ============================================================================== */
.chat-window {
  position: relative;
}

.chat-window.is-dragover-media::after {
  content: "🖼️ Thả hình ảnh vào đây để gửi ngay";
  position: absolute;
  inset: 10px;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(50, 46, 44, 0.84);
  border: 2px dashed #f6e8c8;
  border-radius: 12px;
  color: #f6e8c8;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
  pointer-events: none;
  backdrop-filter: blur(2px);
}

/* Unread Counter Badge & Bold Contrast */
.conv-unread-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.35);
}

.conv-item.has-unread .conv-name,
.conv-item.has-unread .conv-preview {
  font-weight: 700;
  color: #1c1917;
}

/* Consecutive Same-Sender Message Clustering */
.message-group.is-grouped-prev {
  margin-top: -12px;
}

.message-group.is-grouped-next .message-meta {
  display: none;
}

.message-customer.is-grouped-prev .message-bubble {
  border-top-left-radius: 6px;
}

.message-customer.is-grouped-next .message-bubble {
  border-bottom-left-radius: 6px;
}

.message-bot.is-grouped-prev .message-bubble {
  border-top-right-radius: 6px;
}

.message-bot.is-grouped-next .message-bubble {
  border-bottom-right-radius: 6px;
}

/* Bubble Row + Hover Quick Actions (Quote / Copy) */
.message-bubble-row {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.message-bot .message-bubble-row {
  flex-direction: row-reverse;
}

.msg-hover-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
  flex-shrink: 0;
}

.message-group:hover .msg-hover-actions,
.message-group:focus-within .msg-hover-actions {
  opacity: 1;
  pointer-events: auto;
}

.msg-action-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(51, 47, 45, 0.9);
  color: #f6e8c8;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, transform 0.12s ease;
}

.msg-action-btn:hover {
  background: #f6e8c8;
  color: #231f1e;
  border-color: #e2cb99;
  transform: scale(1.06);
}

/* Quoted Message Block Inside Bubble */
.msg-quote-block {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  margin-bottom: 7px;
  border-radius: 7px;
  border-left: 3px solid #9a6b2f;
  background: rgba(35, 31, 30, 0.08);
  cursor: pointer;
  transition: background 0.14s ease;
  max-width: 100%;
  overflow: hidden;
}

.message-bot .msg-quote-block {
  border-left-color: #78716c;
  background: rgba(28, 25, 23, 0.06);
}

.msg-quote-block:hover {
  background: rgba(35, 31, 30, 0.14);
}

.msg-quote-thumb {
  width: 34px;
  height: 34px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.msg-quote-body {
  min-width: 0;
  flex: 1;
}

.msg-quote-sender {
  font-size: 11px;
  font-weight: 700;
  color: #231f1e;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-quote-text {
  font-size: 11.5px;
  line-height: 1.35;
  color: #57534e;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

@keyframes msgHighlightFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(246, 232, 200, 0.9);
  }
  35% {
    box-shadow: 0 0 0 4px rgba(246, 232, 200, 0.78), 0 0 18px rgba(246, 232, 200, 0.45);
  }
  100% {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  }
}

.message-group.msg-highlight-flash .message-bubble {
  animation: msgHighlightFlash 1.4s ease-out;
}

/* Zalo Send Status & Retry */
.msg-send-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 500;
}

.message-bot .msg-send-status {
  align-self: flex-end;
  margin-top: 3px;
}

.msg-send-status.is-sending {
  color: #f6e8c8;
  opacity: 0.85;
}

.msg-send-status.is-sent {
  color: #a8a29e;
}

.msg-send-status.is-error {
  color: #fca5a5;
  font-weight: 600;
}

.msg-retry-btn {
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid rgba(252, 165, 165, 0.45);
  background: rgba(185, 28, 28, 0.25);
  color: #fee2e2;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease;
}

.msg-retry-btn:hover {
  background: #b91c1c;
  color: #ffffff;
}

/* Zalo Quote-Reply Preview Bar Above Composer */
#chat-reply-quote-bar,
.chat-reply-quote-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #332f2d;
  border-top: 1px solid #292524;
  border-left: 3px solid #f6e8c8;
  color: #faf8f4;
  flex-shrink: 0;
}

.chat-reply-quote-accent {
  display: none;
}

.chat-reply-quote-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(246, 232, 200, 0.3);
}

.chat-reply-quote-body {
  flex: 1;
  min-width: 0;
}

.chat-reply-quote-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #f6e8c8;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-reply-quote-text {
  font-size: 12px;
  color: #eae6de;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-reply-quote-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #eae6de;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, color 0.14s ease;
}

.chat-reply-quote-close:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

/* Floating Jump-To-Bottom New Message Pill */
#chat-new-msg-pill,
.chat-new-msg-pill {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid #e2cb99;
  background: #f6e8c8;
  color: #231f1e;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.34);
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

#chat-new-msg-pill:hover,
.chat-new-msg-pill:hover {
  background: #faf8f4;
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42);
}

/* Multiline Auto-Grow Composer & Attach Image Button */
.chat-input-bar {
  align-items: flex-end;
}

textarea.chat-input-field {
  resize: none;
  overflow-y: auto;
  height: auto;
  min-height: 40px;
  max-height: 124px;
  line-height: 1.45;
  padding: 9px 14px;
  font-family: inherit;
}

.chat-attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 10px;
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

.chat-input-bar #btn-quick-reply-picker,
.chat-input-bar #btn-admin-send {
  height: 40px;
  flex-shrink: 0;
}

/* ==============================================================================
   APPLE PWA, MULTI-DEVICE RESPONSIVE (iPhone / iPad / MacBook) & REMOTE ACCESS
   ============================================================================== */
:root {
  --app-height: 100dvh;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

.zalo-app-shell {
  height: var(--app-height, 100dvh);
}

.tablet-inspector-backdrop {
  display: none;
}

/* Reconnecting Status Pill inside Chat Window */
.ws-reconnecting-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px;
  background: #2e2a29;
  color: #f6e8c8;
  border-bottom: 1px solid #44403c;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.1px;
  flex-shrink: 0;
  z-index: 25;
}

/* Remote Access 24/7 & QR Card */
.remote-access-card {
  background: #faf8f4;
  border: 1px solid #d5cfc3;
}

.remote-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.remote-card-head h3 {
  margin-bottom: 0;
}

.remote-funnel-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: #eae6de;
  color: #2e2a29;
  border: 1px solid #cfcbc2;
}

.remote-funnel-badge.is-active,
.remote-funnel-badge.ok {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.remote-funnel-badge.is-offline,
.remote-funnel-badge.err {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.remote-access-body {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.remote-qr-box {
  width: 144px;
  height: 144px;
  padding: 8px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #d5cfc3;
  box-shadow: 0 4px 12px rgba(46, 42, 41, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.remote-qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.remote-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.remote-url-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #eae6de;
  border: 1px solid #d5cfc3;
  border-radius: 8px;
  padding: 8px 11px;
}

.remote-url-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.remote-public-url {
  font-size: 13px;
  font-weight: 700;
  color: #2e2a29;
  word-break: break-all;
  text-decoration: underline;
  text-decoration-color: #b45309;
  text-underline-offset: 2px;
}

.remote-public-url:hover {
  color: #b45309;
}

.remote-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.remote-lan-urls {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
  word-break: break-word;
}

.remote-device-tips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.remote-tip-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 7px;
  background: #f6e8c8;
  color: #2e2a29;
  border: 1px solid #e2cb99;
  font-size: 11.5px;
  line-height: 1.35;
}

/* MacBook Air / Pro Compact 3-Column (1081px - 1366px) */
@media (max-width: 1366px) and (min-width: 1081px) {
  .inbox-container {
    grid-template-columns: 270px minmax(320px, 1fr) 295px;
  }

  .inbox-container.right-collapsed {
    grid-template-columns: 270px minmax(320px, 1fr);
  }
}

/* iPad Portrait & Landscape (769px - 1080px): 2-column base + Slide-over Inspector */
@media (max-width: 1080px) and (min-width: 769px) {
  .inbox-container,
  .inbox-container.right-collapsed {
    grid-template-columns: 265px minmax(0, 1fr);
    position: relative;
  }

  .inbox-container:not(.right-collapsed) .ai-inspector {
    display: flex;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 330px;
    max-width: 85%;
    z-index: 95;
    box-shadow: -10px 0 32px rgba(0, 0, 0, 0.35);
    border-left: 1px solid #cfc9bd;
  }

  .inbox-container.right-collapsed .ai-inspector {
    display: none;
  }

  .tablet-inspector-backdrop {
    display: none;
  }

  .inbox-container:not(.right-collapsed) .tablet-inspector-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.22);
    z-index: 90;
  }
}

/* iPhone (<= 768px): Safe-area insets, VisualViewport height, Popover sizing */
@media (max-width: 768px) {
  html,
  body {
    height: var(--app-height, 100dvh);
    max-height: var(--app-height, 100dvh);
  }

  .zalo-app-shell {
    height: var(--app-height, 100dvh);
  }

  .zalo-left-rail {
    height: auto;
    min-height: calc(46px + env(safe-area-inset-top, 0px));
    padding: calc(4px + env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) 4px max(8px, env(safe-area-inset-left, 0px));
  }

  .chat-input-bar {
    padding: 8px max(10px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  }

  .auth-lock-overlay {
    padding: calc(20px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  }

  .top-inbox-filters-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
  }

  .top-inbox-filters-bar::-webkit-scrollbar {
    display: none;
  }

  body.is-mobile-chat-view .top-inbox-filters-bar {
    display: none !important;
  }

  #zalo-classify-popover,
  #zalo-assign-tag-popover {
    width: min(280px, calc(100vw - 20px));
  }

  .zalo-pop-item {
    min-height: 40px;
  }

  .remote-access-body {
    flex-direction: column;
    align-items: stretch;
  }

  .remote-qr-box {
    align-self: center;
  }
}

/* Touch Devices (iPhone / iPad): 1-tap message actions & visible quick-tag */
@media (hover: none), (pointer: coarse) {
  .conv-quick-tag-btn {
    opacity: 0.78;
    width: 28px;
    height: 28px;
  }

  .message-group.is-touch-active .msg-hover-actions {
    opacity: 1;
    pointer-events: auto;
  }

  .message-group {
    touch-action: pan-y;
  }
}

/* ==============================================================================
   ZALO PC PARITY: PIN, DRAFTS, CONTEXT MENU, REACTIONS, RECALL, SEARCH,
   STICKERS, GALLERY LIGHTBOX, SHARED MEDIA TAB & CLEAN MOBILE PLACEHOLDER
   ============================================================================== */

/* 4-Tab Right Inspector Bar (AI • POS & SPX • CRM • Ảnh/Link) */
.ai-inspector .right-panel-tabs {
  display: flex;
  align-items: stretch;
  gap: 3px;
}

.ai-inspector .right-tab-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 4px;
  font-size: 10.5px;
  gap: 3px;
}

/* Sound Mute Button on Left Rail */
#btn-rail-sound-toggle.is-muted {
  opacity: 0.58;
}

/* Pinned Conversations & Red [Nháp] Draft Prefix */
.conv-item.is-pinned {
  background: rgba(246, 232, 200, 0.25);
}

.conv-item.is-pinned:hover {
  background: rgba(246, 232, 200, 0.42);
}

.conv-item.is-pinned.active {
  background: #f8f6f1;
}

.conv-pin-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  margin-right: 3px;
  flex-shrink: 0;
}

.conv-draft-prefix {
  color: #dc2626;
  font-weight: 700;
  margin-right: 4px;
}

/* Right-Click Conversation Context Menu */
.zalo-conv-context-menu {
  width: 224px;
  z-index: 2650;
}

.zalo-conv-context-menu .zalo-pop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 13px;
  border: none;
  background: transparent;
  color: #f3efe8;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.zalo-conv-context-menu .zalo-pop-item:hover {
  background: rgba(246, 232, 200, 0.14);
  color: #f6e8c8;
}

/* Message Reactions, Floating 6-Emoji Picker & Recalled Bubbles */
.msg-hover-actions {
  position: relative;
}

.msg-reaction-picker-pop {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 999px;
  background: #262322;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.48);
  z-index: 60;
  white-space: nowrap;
}

.message-bot .msg-reaction-picker-pop {
  left: auto;
  right: 0;
}

.msg-reaction-opt-btn,
.msg-reaction-picker-pop button {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.msg-reaction-opt-btn:hover,
.msg-reaction-picker-pop button:hover {
  background: rgba(246, 232, 200, 0.18);
  transform: scale(1.18);
}

.msg-reactions-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.message-bot .msg-reactions-bar {
  align-self: flex-end;
}

.msg-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #262322;
  border: 1px solid rgba(246, 232, 200, 0.28);
  color: #faf8f4;
  font-family: inherit;
  font-size: 11.5px;
  line-height: 1.3;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.14s ease, border-color 0.14s ease;
}

.msg-reaction-chip:hover {
  background: #3e3937;
  border-color: #f6e8c8;
  transform: translateY(-1px);
}

.message-bubble.is-recalled-msg {
  opacity: 0.72;
  font-style: italic;
}

/* In-Thread Search Bar & Highlight Marks */
.chat-inthread-search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: #383331;
  border-bottom: 1px solid #292524;
  flex-shrink: 0;
  z-index: 24;
}

.chat-inthread-search-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #262322;
  color: #faf8f4;
  font-family: inherit;
  font-size: 12px;
  outline: none;
}

.chat-inthread-search-input::placeholder {
  color: rgba(250, 248, 244, 0.48);
}

.chat-inthread-search-input:focus {
  border-color: #f6e8c8;
  background: #1f1c1b;
}

.chat-inthread-search-count {
  font-size: 11px;
  font-weight: 600;
  color: #f6e8c8;
  min-width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.chat-inthread-search-bar .btn-mini {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.2);
  color: #faf8f4;
  height: 28px;
  padding: 0 8px;
  flex-shrink: 0;
}

.chat-inthread-search-bar .btn-mini:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.chat-inthread-search-bar .close-btn {
  border: none;
  background: transparent;
  color: rgba(250, 248, 244, 0.72);
  font-size: 18px;
  line-height: 1;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  flex-shrink: 0;
}

.chat-inthread-search-bar .close-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

mark.chat-search-mark {
  background: #facc15;
  color: #1c1917;
  border-radius: 3px;
  padding: 0 2px;
}

.message-group.is-search-current .message-bubble {
  box-shadow: 0 0 0 2.5px #f6e8c8, 0 0 18px rgba(246, 232, 200, 0.5);
}

/* Sticker & Emoji Popover */
.chat-sticker-popover {
  position: absolute;
  bottom: 62px;
  left: 12px;
  width: min(350px, calc(100% - 24px));
  max-height: 330px;
  background: #3b3634;
  color: #f7f5f0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  z-index: 52;
  overflow: hidden;
}

.sticker-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #322e2c;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.sticker-tabs button,
.sticker-tab-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #eae6de;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.sticker-tabs button.active,
.sticker-tab-btn.active {
  background: #f6e8c8;
  border-color: #e2cb99;
  color: #231f1e;
}

.sticker-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  padding: 10px;
  overflow-y: auto;
}

.sticker-pack-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
}

.sticker-item-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #faf8f4;
  padding: 6px;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.14s ease, transform 0.12s ease, border-color 0.14s ease;
}

.sticker-item-btn:hover {
  background: rgba(246, 232, 200, 0.16);
  border-color: rgba(246, 232, 200, 0.35);
  transform: scale(1.06);
}

.sticker-pack-grid .sticker-item-btn {
  aspect-ratio: 1 / 1;
  padding: 4px;
}

.sticker-pack-grid .sticker-item-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Gallery Lightbox Toolbar, Counter & Navigation */
#media-lightbox-overlay .media-lightbox-inner img,
#media-lightbox-overlay .media-lightbox-inner video {
  transition: transform 0.16s ease;
}

#media-lightbox-overlay .media-lightbox-toolbar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(38, 35, 34, 0.88);
  border: 1px solid rgba(246, 232, 200, 0.24);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 10002;
}

.media-lightbox-btn {
  height: 30px;
  min-width: 30px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #faf8f4;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.media-lightbox-btn:hover {
  background: #f6e8c8;
  color: #231f1e;
  border-color: #e2cb99;
}

.media-lightbox-counter {
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #f6e8c8;
  white-space: nowrap;
}

.media-lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(246, 232, 200, 0.28);
  background: rgba(38, 35, 34, 0.78);
  color: #faf8f4;
  font-size: 24px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10002;
  transition: background 0.14s ease, color 0.14s ease, transform 0.14s ease;
}

.media-lightbox-nav:hover {
  background: #f6e8c8;
  color: #231f1e;
}

.media-lightbox-nav.prev {
  left: 16px;
}

.media-lightbox-nav.next {
  right: 16px;
}

/* Right Inspector 4th Pane: Shared Media & Links */
.chat-shared-media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.chat-shared-media-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #d5cfc3;
  background: #262322;
  padding: 0;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.14s ease;
}

.chat-shared-media-tile:hover {
  border-color: #383331;
  transform: scale(1.02);
}

.chat-shared-media-tile img,
.chat-shared-media-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chat-shared-links-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-shared-link-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 9px;
  border-radius: 7px;
  background: #faf8f4;
  border: 1px solid #dcd6ca;
  color: #1d4ed8;
  font-size: 11.5px;
  line-height: 1.4;
  text-decoration: none;
  word-break: break-all;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.chat-shared-link-item:hover {
  border-color: #9e9689;
  background: #ffffff;
}

/* Clean Single-Line Unclipped Composer Placeholder on Desktop, Tablet & Mobile */
textarea.chat-input-field {
  min-width: 0;
}

textarea.chat-input-field::placeholder {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  textarea.chat-input-field {
    min-height: 40px;
    padding: 9px 12px;
    line-height: 1.38;
  }

  textarea.chat-input-field::placeholder {
    font-size: 13.5px;
    line-height: 22px;
  }

  .chat-input-bar #btn-quick-reply-picker {
    padding: 0 8px;
    font-size: 11.5px;
  }

  .chat-attach-btn {
    padding: 0 8px;
  }

  .media-lightbox-nav {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .media-lightbox-nav.prev {
    left: 8px;
  }

  .media-lightbox-nav.next {
    right: 8px;
  }

  #media-lightbox-overlay .media-lightbox-toolbar {
    top: 12px;
    left: 12px;
    transform: none;
    max-width: calc(100vw - 74px);
    overflow-x: auto;
  }
}

@media (max-width: 600px) {
  .chat-input-bar {
    gap: 5px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px)) 8px;
  }

  .chat-input-bar #btn-quick-reply-picker {
    width: 34px;
    min-width: 34px;
    height: 36px;
    padding: 0;
    justify-content: center;
    font-size: 15px;
  }

  .quick-reply-btn-label {
    display: none;
  }

  .chat-input-bar .chat-attach-btn {
    width: 34px;
    min-width: 34px;
    height: 36px;
    padding: 0;
  }

  .chat-input-bar #btn-admin-send {
    height: 36px;
    padding: 0 11px;
    font-size: 12.5px;
  }

  textarea.chat-input-field {
    padding: 9px 10px;
    font-size: 13px;
  }

  textarea.chat-input-field::placeholder {
    font-size: 13px;
    line-height: 22px;
  }
}

/* Inline Customer Alias (Tên gợi nhớ) Editor inside Chat Header */
.chat-header-title {
  cursor: default;
}
.chat-header-title.can-edit-alias {
  cursor: pointer;
}
.chat-header-title.can-edit-alias:hover {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.chat-alias-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid rgba(128, 128, 128, 0.28);
  background: transparent;
  color: inherit;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.72;
  transition: opacity 0.14s ease, transform 0.14s ease, background 0.14s ease;
  flex-shrink: 0;
}
.chat-alias-edit-btn:hover {
  opacity: 1;
  background: rgba(128, 128, 128, 0.14);
}
.chat-alias-editor {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 100%;
}
.chat-alias-input {
  width: 210px;
  max-width: 48vw;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border, #d4d4d8);
  background: var(--bg-card, #ffffff);
  color: var(--text-main, #18181b);
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 600;
  outline: none;
}
.chat-alias-input:focus {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
.chat-alias-save-btn {
  height: 28px !important;
  padding: 0 9px !important;
  font-weight: 700 !important;
}
.chat-alias-reset-btn,
.chat-alias-cancel-btn {
  height: 28px !important;
  padding: 0 7px !important;
}


