/* Keep agent identity readable in the embedded CRM and slightly enlarge
   message avatars in both the dashboard and storefront widget. */
.message-bubble-container.justify-end > .grid {
  grid-template-columns: minmax(0, 1fr) 56px !important;
}

.message-bubble-container [class*="grid-area:avatar"] {
  min-width: 56px;
  flex-direction: column;
  align-items: center !important;
  justify-content: flex-end;
  gap: 3px;
}

.message-bubble-container [class*="grid-area:avatar"] > span,
.message-bubble-container [class*="grid-area:avatar"] span[role="img"] {
  width: 28px !important;
  height: 28px !important;
}

.message-bubble-container [class*="grid-area:avatar"] img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nk-agent-name {
  display: block;
  width: 56px;
  overflow: hidden;
  color: var(--color-n-slate-11, #687078);
  font-size: 11px;
  font-weight: 500;
  line-height: 14px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nk-storefront-icon {
	display: block;
	width: 16px;
	height: 16px;
	flex: 0 0 16px;
	border: 1px solid var(--color-n-slate-4, #e2e8f0);
	border-radius: 3px;
	background: #fff;
	object-fit: contain;
}

.nk-channel-storefront-label {
	display: flex;
	align-items: center;
	gap: 6px;
}

.nk-channel-storefront-icon {
	display: block;
	width: 16px;
	height: 16px;
	flex: 0 0 16px;
	border: 1px solid var(--color-n-slate-4, #e2e8f0);
	border-radius: 3px;
	background: #fff;
	object-fit: contain;
}

.header-expanded > .flex.items-start > img[alt="Avatar"] {
  width: 36px !important;
  height: 36px !important;
  flex: 0 0 36px;
  border-radius: 6px !important;
  object-fit: contain;
}

.header-expanded:has(> .flex.items-start > img[alt="Avatar"]) > h2 {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: flex-start;
  margin: -36px 8px 8px 46px !important;
  font-size: 30px !important;
  line-height: 36px;
  text-align: left;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .header-expanded:has(> .flex.items-start > img[alt="Avatar"]) > h2 {
    font-size: 22px !important;
    line-height: 28px;
  }
}

.nk-widget-start-loading {
  position: relative !important;
}

.nk-widget-start-loading i.i-lucide-chevron-right {
  visibility: hidden;
}

.nk-widget-start-loading::after {
  position: absolute;
  top: var(--nk-widget-spinner-top, 50%);
  left: var(--nk-widget-spinner-left, 50%);
  width: 15px;
  height: 15px;
  box-sizing: border-box;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: '';
  animation: nk-widget-spin 700ms linear infinite;
}

@keyframes nk-widget-spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.conversation-wrap .agent-message .avatar-wrap {
  width: 28px !important;
  height: 28px !important;
}

.conversation-wrap .agent-message .avatar-wrap .user-thumbnail-box > span,
.conversation-wrap .agent-message .avatar-wrap span[role="img"] {
  width: 28px !important;
  height: 28px !important;
}

.conversation-wrap .agent-message .avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Present unread messages as a compact replacement for the draggable
   storefront launcher. Parent-page code anchors this card to the launcher. */
html:has(.unread-wrap),
body:has(.unread-wrap),
#app:has(.unread-wrap) {
  background: #fff !important;
}

#app:has(.unread-wrap) > .flex.flex-col {
  justify-content: center !important;
}

.unread-wrap {
  box-sizing: border-box;
  gap: 0;
  margin-block: auto !important;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff !important;
  box-shadow: none;
}

.unread-wrap .close-unread-wrap {
  display: flex;
  justify-content: flex-end;
}

.unread-wrap .close-unread-button {
  min-height: 32px;
  margin: 0 0 4px !important;
  padding: 0 12px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 999px !important;
  background: #f8fafc !important;
  color: #475569 !important;
  font-size: 13px !important;
  line-height: 30px !important;
}

.unread-wrap .close-unread-button:hover {
  border-color: #cbd5e1 !important;
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

.unread-wrap .unread-messages {
  padding-bottom: 10px !important;
}

.unread-wrap .chat-bubble-wrap + .chat-bubble-wrap {
  margin-top: 6px;
}

.unread-wrap .chat-bubble {
  width: 100%;
  max-width: 100% !important;
  padding: 12px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  background: #fff !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07) !important;
  text-align: left;
}

.unread-wrap .open-read-view-wrap {
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

.unread-wrap .open-read-view-wrap .clear-button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 1px solid var(--nk-unread-brand, #0f172a) !important;
  border-radius: 7px !important;
  background: var(--nk-unread-brand, #0f172a) !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.unread-wrap .open-read-view-wrap .clear-button > span {
  justify-content: center;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
}

.unread-wrap .open-read-view-wrap .clear-button:hover {
  filter: brightness(0.9);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.24);
  transform: translateY(-1px);
}

@media (max-width: 767px) {
  .unread-wrap {
    padding: 10px;
  }

  .unread-wrap .chat-bubble {
    padding: 10px !important;
  }
}
