/* ==========================================================================
   Chat Inbox Screen — 1:1 Replica of Desktop App
   (ChatPage.tsx, ChatSidebar.tsx, ChatTimeline.tsx, BuyerCrmPanel.tsx, AutoReplyModal.tsx)
   ========================================================================== */

#sbx-root .sbx-main:has(.chat-page-shell) {
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#sbx-root .chat-page-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 560px;
  height: 100%;
  max-height: none;
  background: var(--surface-color);
  border-radius: 20px;
  border: 1px solid var(--surface-border);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
}

#sbx-root[data-theme="dark"] .chat-page-shell {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

#sbx-root .chat-inbox-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  position: relative;
  transition: grid-template-columns 0.25s ease;
}

#sbx-root .chat-inbox-grid.crm-open {
  grid-template-columns: 320px minmax(0, 1fr) 300px;
}

/* ==========================================================================
   COLUMN 1: ChatSidebar
   ========================================================================== */
#sbx-root .chat-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
  background: var(--surface-color);
  border-right: 1px solid var(--surface-border);
}

#sbx-root .chat-sidebar-header {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex-shrink: 0;
}

#sbx-root .chat-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

#sbx-root .chat-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

#sbx-root .chat-sidebar-brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 8px var(--primary-glow);
  flex-shrink: 0;
}

#sbx-root .chat-sidebar-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
}

#sbx-root .chat-sidebar-subtitle {
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.25;
  white-space: nowrap;
}

#sbx-root .chat-sidebar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

#sbx-root .chat-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 26px;
  min-height: 26px;
  width: 26px;
  padding: 0;
  border-radius: 7px;
  background: var(--hover-bg);
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

#sbx-root .chat-icon-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--text-primary);
  background: var(--surface-hover);
}

#sbx-root .chat-icon-btn.bot-btn {
  color: #818cf8;
  width: auto;
  min-width: 26px;
  padding: 0 6px;
}

#sbx-root .chat-icon-btn.bot-btn.is-locked {
  color: var(--text-secondary);
}

#sbx-root .chat-unread-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-size: 0.66rem;
  font-weight: 700;
  border: 1px solid rgba(239, 68, 68, 0.3);
  white-space: nowrap;
}

#sbx-root .chat-select-wrap,
#sbx-root .chat-search-wrap {
  position: relative;
  width: 100%;
}

#sbx-root .chat-select-wrap select {
  width: 100%;
  padding: 7px 30px 7px 32px;
  min-height: 34px;
  border-radius: 8px;
  background: var(--input-bg);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  outline: none;
  transition: all 0.15s ease;
}

#sbx-root .chat-search-wrap input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  min-height: 34px;
  border-radius: 8px;
  background: var(--input-bg);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  font-size: 0.8rem;
  outline: none;
  transition: all 0.15s ease;
}

#sbx-root .chat-search-wrap input:focus,
#sbx-root .chat-select-wrap select:focus {
  border-color: var(--primary);
  background: var(--surface-card);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

#sbx-root .chat-input-icon-left {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

#sbx-root .chat-input-icon-right {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

/* 3 Filter Tabs in Sidebar */
#sbx-root .chat-filter-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  background: var(--hover-bg);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
}

#sbx-root .chat-filter-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 4px;
  min-height: 30px;
  min-width: 0;
  overflow: hidden;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.73rem;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

#sbx-root .chat-filter-tab svg {
  flex-shrink: 0;
}

#sbx-root .chat-filter-tab > span:not(.chat-filter-tab-badge) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sbx-root .chat-filter-tab:hover {
  color: var(--text-primary);
}

#sbx-root .chat-filter-tab.is-active {
  background: var(--surface-color);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

#sbx-root .chat-filter-tab-badge {
  background-color: #ef4444;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0 4px;
  min-width: 15px;
  height: 15px;
  line-height: 15px;
  border-radius: 999px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Conversation List & Items */
#sbx-root .chat-conv-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 6px;
  gap: 3px;
  scrollbar-width: thin;
}

#sbx-root .chat-conv-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  position: relative;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
}

#sbx-root .chat-conv-item:hover {
  background: var(--hover-bg);
}

#sbx-root .chat-conv-item.is-selected {
  background: var(--hover-bg);
  border-color: var(--primary-glow);
}

#sbx-root .chat-conv-item.is-unavailable {
  opacity: 0.48;
  filter: grayscale(0.75);
}

#sbx-root .chat-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

#sbx-root .chat-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--surface-border);
  flex-shrink: 0;
  user-select: none;
}

#sbx-root .chat-avatar-unread-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

#sbx-root .chat-conv-body {
  flex: 1;
  min-width: 0;
}

#sbx-root .chat-conv-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

#sbx-root .chat-conv-buyer {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sbx-root .chat-conv-item.is-unread .chat-conv-buyer {
  font-weight: 700;
}

#sbx-root .chat-conv-time {
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

#sbx-root .chat-conv-item.is-unread .chat-conv-time {
  color: var(--primary);
  font-weight: 600;
}

#sbx-root .chat-conv-row-mid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
  gap: 6px;
}

#sbx-root .chat-conv-preview {
  font-size: 0.78rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

#sbx-root .chat-conv-item.is-unread .chat-conv-preview {
  color: var(--text-primary);
  font-weight: 600;
}

#sbx-root .chat-badge-unread {
  background-color: #ef4444;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
  flex-shrink: 0;
}

#sbx-root .chat-badge-unreplied {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  color: #ffffff;
  background-color: #f97316;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3);
}

#sbx-root .chat-badge-closed {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  color: var(--text-secondary);
  background: var(--hover-bg);
  border: 1px solid var(--surface-border);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

#sbx-root .chat-conv-row-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  flex-wrap: wrap;
}

#sbx-root .chat-crm-mini-tag {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

/* ==========================================================================
   COLUMN 2: ChatTimeline
   ========================================================================== */
#sbx-root .chat-timeline {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
  background: var(--bg-color);
  position: relative;
}

#sbx-root .chat-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-color);
  border-bottom: 1px solid var(--surface-border);
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
  z-index: 10;
}

#sbx-root .chat-header-buyer {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 170px;
  flex: 1;
}

#sbx-root .chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

#sbx-root .chat-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  min-height: 30px;
  border-radius: 8px;
  background: var(--hover-bg);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

#sbx-root .chat-action-btn:hover {
  border-color: var(--primary);
}

#sbx-root .chat-action-btn.is-unreplied {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}

#sbx-root .chat-action-btn.is-crm-active {
  background: var(--hover-bg);
  color: var(--primary);
}

/* Messages Stream */
#sbx-root .chat-messages-stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
}

#sbx-root .chat-history-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

#sbx-root .chat-history-pill-btn:hover {
  border-color: var(--primary);
  background: var(--hover-bg);
}

#sbx-root .chat-date-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 8px 0 4px;
}

#sbx-root .chat-date-divider > span {
  background: var(--hover-bg);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 500;
  padding: 3px 12px;
  border-radius: 9999px;
  border: 1px solid var(--surface-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  user-select: none;
}

#sbx-root .chat-msg-row {
  display: flex;
  flex-direction: column;
  width: 100%;
}

#sbx-root .chat-msg-row.is-buyer {
  align-items: flex-start;
}

#sbx-root .chat-msg-row.is-shop {
  align-items: flex-end;
}

#sbx-root .chat-msg-group {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 80%;
}

#sbx-root .chat-msg-row.is-shop .chat-msg-group {
  flex-direction: row-reverse;
}

#sbx-root .chat-msg-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

#sbx-root .chat-msg-row.is-shop .chat-msg-stack {
  align-items: flex-end;
}

#sbx-root .chat-msg-row.is-buyer .chat-msg-stack {
  align-items: flex-start;
}

#sbx-root .chat-bubble-text {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#sbx-root .chat-msg-row.is-buyer .chat-bubble-text {
  border-top-left-radius: 2px;
  background: var(--surface-color);
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
}

#sbx-root .chat-msg-row.is-shop .chat-bubble-text {
  border-top-right-radius: 2px;
  background: var(--primary-gradient);
  color: #ffffff;
  border: none;
}

#sbx-root .chat-msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  padding: 0 2px;
}

/* Rich Cards inside ChatTimeline (Product, Order, Voucher, Bundle) */
#sbx-root .chat-rich-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  background: var(--surface-color);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  color: var(--text-primary);
}

#sbx-root .chat-product-card {
  max-width: 300px;
  min-width: 240px;
  width: 100%;
}

#sbx-root .chat-order-card {
  max-width: 320px;
  min-width: 260px;
  width: 100%;
  padding: 12px;
  gap: 10px;
}

#sbx-root .chat-voucher-card {
  max-width: 350px;
  min-width: 260px;
  width: 100%;
  padding: 12px;
  gap: 10px;
}

#sbx-root .chat-bundle-card {
  max-width: 340px;
  min-width: 240px;
  width: 100%;
  padding: 12px 14px;
  gap: 8px;
}

/* Composer Footer & .chat-composer-box */
#sbx-root .chat-timeline-footer {
  position: relative;
  padding: 12px 18px;
  background: var(--surface-color);
  border-top: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

#sbx-root .chat-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  position: relative;
}

#sbx-root .chat-composer-box {
  flex: 1;
  position: relative;
  border-radius: 12px;
  background: var(--input-bg);
  border: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

#sbx-root .chat-composer-box:focus-within {
  border-color: var(--primary);
  background: var(--surface-card);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

#sbx-root .chat-composer-textarea {
  width: 100%;
  min-height: 46px;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 10px 14px 4px;
  color: var(--text-primary);
  font-size: 0.875rem;
  line-height: 1.45;
  resize: none;
}

#sbx-root .chat-composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 8px;
  gap: 8px;
}

#sbx-root .chat-composer-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

#sbx-root .chat-tool-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 4px 8px;
  min-height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

#sbx-root .chat-tool-btn:hover:not(:disabled) {
  background: var(--hover-bg);
  color: var(--text-primary);
}

#sbx-root .chat-send-btn {
  height: 44px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--primary-gradient);
  color: #ffffff;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--primary-glow);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

#sbx-root .chat-send-btn:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

#sbx-root .chat-send-btn:disabled {
  background: var(--hover-bg);
  color: var(--text-secondary);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}

/* QuickReplySlashMenu Popover */
#sbx-root .chat-slash-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 18px;
  right: 18px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
  z-index: 50;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#sbx-root .chat-slash-option {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  width: 100%;
  transition: all 0.15s ease;
}

#sbx-root .chat-slash-option:hover,
#sbx-root .chat-slash-option.is-selected {
  background: var(--hover-bg);
  border-color: var(--primary-glow);
}

/* StickerPicker Popover (330x350px) */
#sbx-root .chat-sticker-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 18px;
  width: 330px;
  max-width: calc(100vw - 36px);
  max-height: 350px;
  overflow-y: auto;
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
  z-index: 55;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
}

#sbx-root .chat-sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

#sbx-root .chat-sticker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

#sbx-root .chat-sticker-item:hover {
  background: var(--hover-bg);
  border-color: var(--primary-glow);
  transform: translateY(-1px);
}

/* ==========================================================================
   COLUMN 3: BuyerCrmPanel
   ========================================================================== */
#sbx-root .chat-crm-panel,
#sbx-root .sbx-chat-crm {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  background: var(--surface-color);
  border-left: 1px solid var(--surface-border);
  padding: 16px;
  gap: 20px;
  scrollbar-width: thin;
}

#sbx-root .chat-crm-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--surface-border);
}

#sbx-root .chat-crm-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
}

#sbx-root .chat-crm-stat-box {
  background: var(--hover-bg);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  text-align: center;
}

#sbx-root .chat-crm-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#sbx-root .chat-crm-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

#sbx-root .chat-crm-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

#sbx-root .chat-crm-profile,
#sbx-root .chat-crm-section {
  flex-shrink: 0;
}

#sbx-root .chat-crm-order-item {
  display: flex;
  flex-direction: column;
  padding: 10px;
  border-radius: 8px;
  background: var(--hover-bg);
  border: 1px solid var(--surface-border);
  gap: 6px;
  flex-shrink: 0;
}

/* Responsive adjustments */
@media (max-width: 1360px) and (min-width: 1024px) {
  #sbx-root .chat-inbox-grid {
    grid-template-columns: 296px minmax(0, 1fr);
  }
  #sbx-root .chat-inbox-grid.crm-open {
    grid-template-columns: 290px minmax(0, 1fr) 280px;
  }
}

@media (max-width: 1023px) {
  #sbx-root .chat-inbox-grid,
  #sbx-root .chat-inbox-grid.crm-open {
    grid-template-columns: 260px minmax(0, 1fr) !important;
  }
  #sbx-root .chat-crm-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(310px, 88vw);
    z-index: 30;
    box-shadow: var(--shadow-lg, -8px 0 28px rgba(15, 23, 42, 0.25));
  }
}

@media (max-width: 767px) {
  #sbx-root .chat-page-shell {
    height: auto;
    max-height: none;
  }
  #sbx-root .chat-inbox-grid,
  #sbx-root .chat-inbox-grid.crm-open {
    grid-template-columns: 1fr !important;
  }
  #sbx-root .chat-conv-list {
    max-height: 260px;
  }
  #sbx-root .chat-messages-stream {
    max-height: 52vh;
  }
  #sbx-root .hide-on-compact {
    display: none;
  }
}
