/* =========================
  1. Messages App Shell Start
========================= */

.sw-app__main {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.sw-message__content {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sw-msg-app {
  display: grid;
  grid-template-columns: minmax(0, min(380px, 40%)) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
/* =========================
  1. Messages App Shell End
========================= */

/* =========================
  2. Inbox Panel Start
========================= */
.sw-inbox {
  background: #fff;
  border: 1px solid #ece9e0;
  border-radius: 16px 0 0 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}
.sw-inbox__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 14px;
}
.sw-inbox__title {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.sw-inbox__title h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: #0f1020;
  margin: 0;
}
.sw-inbox__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--sw-violet-50);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sw-violet);
}

.sw-inbox__compose {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: var(--sw-violet);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sw-inbox__compose:hover {
  background: var(--sw-violet-600);
}

/* Inbox search */
.sw-inbox__search {
  padding: 0 20px 18px;
}
.sw-inbox__search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  background: #f3f4f6;
  border: 1px solid #ece9e0;
  border-radius: 10px;
  width: 100%;
}
.sw-inbox__search-input:focus-within {
  background: #fff;
  border-color: var(--sw-violet);
  box-shadow: 0 0 0 3px rgba(110, 93, 248, 0.15);
}
.sw-inbox__search-input input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
  color: #0f1020;
}
.sw-inbox__search-input input::placeholder {
  color: #9ca3af;
}
.sw-inbox__search-input svg {
  width: 16px;
  height: 16px;
  color: #9ca3af;
}

.sw-inbox__filters {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #ece9e0;
  padding: 8px 20px;
}
.sw-inbox-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  text-decoration: none;
}
.sw-inbox-tab:hover {
  background: #f9fafb;
  color: #0f1020;
}
.sw-inbox-tab.is-active {
  background: var(--sw-violet-50);
  color: var(--sw-violet);
  font-weight: 600;
}
.sw-inbox-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0);
  font-size: 11px;
  font-weight: 700;
  color: inherit;
}
.sw-inbox-tab.is-active .sw-inbox-tab__count {
  background: var(--sw-violet);
  color: #fff;
}
.sw-inbox-tab__count--gray {
  background: #f3f4f6;
  color: #6b7280;
}

.sw-conv-list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid #f3f4f6;
}
.sw-conv {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}
.sw-conv:hover {
  background: #fafafb;
}
.sw-conv.is-active {
  background: #f0ebff;
}
.sw-conv:last-child {
  border-bottom: 0;
}

.sw-conv__photo {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  object-fit: cover;
  background: #f3f4f6;
  flex-shrink: 0;
}
.sw-conv__photo--letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0ebff;
  color: var(--sw-violet);
  font-size: 14px;
  font-weight: 600;
}

.sw-conv__col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sw-conv__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sw-conv__name-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.sw-conv__name {
  font-size: 13px;
  font-weight: 600;
  color: #1a1232;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sw-conv__role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  background: #ddd9fc;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.54px;
  color: var(--sw-violet);
  flex-shrink: 0;
}
.sw-conv__time {
  font-size: 11px;
  color: #9ca3af;
  flex-shrink: 0;
}
.sw-conv__bottom {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sw-conv__preview {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: #6b7280;
  line-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sw-conv__unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--sw-violet);
  flex-shrink: 0;
}
/* =========================
  2. Inbox Panel End
========================= */

/* =========================
  3. Chat Panel Start
========================= */
.sw-chat {
  background: #fff;
  border: 1px solid #ece9e0;
  border-radius: 0 16px 16px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sw-chat__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid #ece9e0;
}
.sw-chat__back {
  width: 36px;
  height: 36px;
  display: none;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border: 0;
  border-radius: 8px;
  color: #0f1020;
  cursor: pointer;
}
.sw-chat__back svg {
  width: 18px;
  height: 18px;
}
.sw-chat__photo {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f3f4f6;
}
.sw-chat__person {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
.sw-chat__name-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.sw-chat__name {
  font-size: 14px;
  font-weight: 600;
  color: #0f1020;
}
.sw-chat__online-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #10b981;
}
.sw-chat__role {
  font-size: 11px;
  color: #6b7280;
}
.sw-chat__role strong {
  color: #10b981;
}

.sw-chat__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sw-chat__action-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #ece9e0;
  border-radius: 8px;
  color: #6b7280;
  cursor: pointer;
}
.sw-chat__action-btn:hover {
  background: #f9fafb;
  color: #0f1020;
}
.sw-chat__action-btn svg {
  width: 16px;
  height: 16px;
}

.sw-chat__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  background: #f5f4fe;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Day separator */
.sw-chat__day {
  width: 100%;
  display: flex;
  align-items: center;
  font-size: 10px;
  color: #9ca3af;
  font-weight: 600;
  margin: 0;
}

.sw-chat__day-line {
  flex: 1;
  height: 1px;
  background: #ece9e0;
  border: 0;
  margin: 0;
}

/* Message row + bubble */
.sw-msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 80%;
}
.sw-msg-row__photo {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
}
.sw-msg-row__bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 100%;
}
.sw-msg-bubble {
  padding: 10px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 20px;
  background: #fff;
  border: 1px solid #ece9e0;
  color: #0f1020;
  word-wrap: break-word;
}
.sw-msg-row__time {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 4px;
  font-weight: 400;
}

.sw-msg-row--out {
  margin-left: auto;
  align-items: flex-end;
}
.sw-msg-row--out .sw-msg-bubble {
  background: var(--sw-violet);
  color: #fff;
  border-color: var(--sw-violet);
}
.sw-msg-row--out .sw-msg-row__bubble-wrap {
  align-items: flex-end;
}

.sw-msg-quote {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
  padding: 6px 10px 6px 10px;
  background: #f3f4f6;
  border-left: 3px solid var(--sw-violet);
  border-radius: 6px;
  max-width: 100%;
}
.sw-msg-quote__author {
  font-size: 11px;
  font-weight: 600;
  color: var(--sw-violet);
  line-height: 16px;
}
.sw-msg-quote__text {
  font-size: 12px;
  color: #6b7280;
  line-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sw-msg-row__time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sw-msg-row__time-icon {
  width: 12px;
  height: 12px;
  color: #9ca3af;
}

/* Reply preview bar between chat body and composer */
.sw-chat__reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px 12px 28px;
  background: #f5f4fe;
  border-top: 1px solid #ece9e0;
}
.sw-chat__reply-info {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.sw-chat__reply-icon {
  width: 16px;
  height: 16px;
  color: #6e5df8;
  flex-shrink: 0;
}
.sw-chat__reply-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sw-chat__reply-label {
  font-size: 12px;
  font-weight: 600;
  color: #6e5df8;
  line-height: 16px;
}
.sw-chat__reply-text {
  font-size: 11px;
  font-weight: 400;
  color: #6b7280;
  line-height: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sw-chat__reply-close {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 0;
  border-radius: 999px;
  color: #6b7280;
  cursor: pointer;
  flex-shrink: 0;
}
.sw-chat__reply-close:hover {
  color: #0f1020;
}
.sw-chat__reply-close svg {
  width: 14px;
  height: 14px;
}

.sw-chat__composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #f3f4f6;
  background: #fff;
}
.sw-chat__attach,
.sw-chat__send {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.sw-chat__attach {
  background: #f3f4f6;
  color: #6b7280;
}
.sw-chat__attach:hover {
  background: #e9eaee;
  color: #0f1020;
}
.sw-chat__attach svg {
  width: 18px;
  height: 18px;
}

.sw-chat__box-wrap {
  display: flex;
  flex: 1;
  position: relative;
}

.sw-chat__input-wrap {
  flex: 1;
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: #f3f4f6;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}
.sw-chat__input-wrap:focus-within {
  background: #fff;
  border-color: var(--sw-violet);
  box-shadow: 0 0 0 3px rgba(110, 93, 248, 0.15);
}
.sw-chat__input-wrap input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  color: #0f1020;
}
.sw-chat__input-wrap input::placeholder {
  color: #9ca3af;
}

.sw-chat__send {
  background: transparent;
  color: var(--sw-violet);
  position: absolute;
  right: 4px;
}
.sw-chat__send:hover {
  background: var(--sw-violet-50);
}
.sw-chat__send svg {
  width: 22px;
  height: 22px;
}
/* =========================
  3. Chat Panel End
========================= */

/* =========================
  4. Empty States Start
  Hidden by default — show by adding `sw-msg-app--empty` on `.sw-msg-app`.
========================= */
.sw-msg-app--empty {
  display: grid;
  grid-template-columns: minmax(0, min(380px, 40%)) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.sw-inbox__empty,
.sw-chat__empty {
  display: none;
}

/* When the inbox is empty, swap list/conversation for the empty placeholders */
.sw-msg-app--empty .sw-conv-list {
  display: none;
}
.sw-msg-app--empty .sw-inbox__empty {
  display: flex;
}
.sw-msg-app--empty .sw-chat__head,
.sw-msg-app--empty .sw-chat__body,
.sw-msg-app--empty .sw-chat__reply-preview,
.sw-msg-app--empty .sw-chat__composer {
  display: none;
}
.sw-msg-app--empty .sw-chat__empty {
  display: flex;
}

.sw-msg-app--empty .sw-chat {
  border-left: 0;
}

/* Inbox empty (small, fills the conversation list area) */
.sw-inbox__empty {
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 32px;
  text-align: center;
  background: #fff;
}

/* Chat empty (large, fills the whole chat panel) */
.sw-chat__empty {
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 80px;
  text-align: center;
  background: #fff;
}

.sw-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #f0ebff;
  color: var(--sw-violet);
}
.sw-empty__icon--sm {
  width: 48px;
  height: 48px;
}
.sw-empty__icon--sm svg {
  width: 22px;
  height: 22px;
}
.sw-empty__icon--lg {
  width: 112px;
  height: 112px;
}
.sw-empty__icon--lg svg {
  width: 48px;
  height: 48px;
}

.sw-empty__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1a1232;
  line-height: 20px;
}
.sw-empty__title--lg {
  font-size: 22px;
  font-weight: 600;
  line-height: 28px;
}

.sw-empty__text {
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  color: #9ca3af;
  line-height: 16px;
  max-width: 280px;
}
.sw-empty__text--lg {
  font-size: 14px;
  color: #6b7280;
  line-height: 20px;
  max-width: 420px;
}

/* Chat empty */
.sw-chat__empty .sw-empty__title--lg + .sw-empty__text--lg {
  margin-top: -10px;
}

.sw-empty__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  background: #6e5df8;
  border: 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}
.sw-empty__cta:hover {
  background: var(--sw-violet-600);
  color: #fff;
}
.sw-empty__cta svg {
  width: 16px;
  height: 16px;
}
/* =========================
  4. Empty States End
========================= */

/* =========================
  5. Responsive Start
========================= */
@media (max-width: 991px) {
  .sw-app-footer {
    display: none;
  }
  .sw-msg-app {
    display: block;
  }
  .sw-msg-app .sw-inbox,
  .sw-msg-app .sw-chat {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border: 0;
    height: 100%;
  }
  .sw-msg-app[data-view="inbox"] .sw-chat {
    display: none;
  }
  .sw-msg-app[data-view="chat"] .sw-inbox {
    display: none;
  }

  /* Empty state on mobile/tablet: always show ONLY the chat empty
     full-screen, regardless of data-view. Use compound class for
     specificity to win over the [data-view] rules above. */
  .sw-msg-app.sw-msg-app--empty .sw-inbox {
    display: none;
  }
  .sw-msg-app.sw-msg-app--empty .sw-chat {
    display: flex;
  }
  .sw-msg-app--empty .sw-chat__empty {
    padding: 24px;
  }

  /* Mobile-only back button */
  .sw-chat__back {
    display: inline-flex;
  }

  .sw-msg-app--empty {
    display: block;
  }

  .sw-msg-app--empty .sw-chat {
    display: none;
  }
}

@media (max-width: 575px) {
  .sw-chat__head {
    padding: 12px 16px;
  }
  .sw-chat__body {
    padding: 16px;
  }
  .sw-chat__composer {
    padding: 12px 16px;
  }
  .sw-msg-row {
    max-width: 85%;
  }
  .sw-chat__input-wrap {
    height: 44px;
  }
  .sw-chat__attach,
  .sw-chat__send {
    width: 44px;
    height: 44px;
  }
}
/* =========================
  4. Responsive End
========================= */
