/* Messaging / chat / inbox — brand primary #2d3e50, motion from base */

.chat-page {
  font-family: var(--font-sans, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
}

/* ——— Inbox page ——— */

.inbox-page {
  max-width: 40rem;
  padding: 1.5rem 1rem 5rem;
}

@media (min-width: 768px) {
  .inbox-page {
    padding-bottom: 2rem;
  }
}

.inbox-page__head {
  margin-bottom: 1.25rem;
  animation: ui-fade-in var(--motion-enter, 300ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.inbox-page__title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--home-text, #212529);
  margin: 0 0 0.25rem;
}

.inbox-page__lead {
  margin: 0;
  font-size: 0.875rem;
  color: var(--home-text-secondary, #5f6b75);
}

.inbox-list {
  display: flex;
  flex-direction: column;
  background: var(--home-surface, #fff);
  border: 1px solid var(--home-border, #e2e6ea);
  border-radius: var(--home-radius, 16px);
  overflow: hidden;
  box-shadow: var(--home-shadow-xs, 0 1px 1px rgba(33, 37, 41, 0.04));
}

.inbox-list__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--home-border, #e2e6ea);
  min-height: var(--home-tap-min, 2.75rem);
  transition:
    background var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    box-shadow var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
  animation: ui-fade-in var(--motion-enter, 300ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.inbox-list__item:nth-child(1) { animation-delay: 0.02s; }
.inbox-list__item:nth-child(2) { animation-delay: 0.04s; }
.inbox-list__item:nth-child(3) { animation-delay: 0.06s; }
.inbox-list__item:nth-child(4) { animation-delay: 0.08s; }
.inbox-list__item:nth-child(5) { animation-delay: 0.1s; }
.inbox-list__item:nth-child(6) { animation-delay: 0.12s; }
.inbox-list__item:nth-child(7) { animation-delay: 0.14s; }
.inbox-list__item:nth-child(8) { animation-delay: 0.16s; }
.inbox-list__item:nth-child(n+9) { animation-delay: 0.18s; }

.inbox-list__item:last-child {
  border-bottom: none;
}

.inbox-list__item:hover {
  background: var(--home-primary-light, #e8eef4);
}

.inbox-list__item:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--home-primary, #2d3e50);
  background: var(--home-primary-light, #e8eef4);
}

.inbox-list__body {
  flex: 1;
  min-width: 0;
}

.inbox-list__name {
  font-weight: 600;
  color: var(--home-text, #212529);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-list__meta,
.inbox-list__time {
  font-size: 0.8125rem;
  color: var(--home-text-muted, #8a949b);
}

.inbox-list__meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-list__time {
  flex-shrink: 0;
}

.inbox-empty {
  background: var(--home-surface, #fff);
  border: 1px solid var(--home-border, #e2e6ea);
  border-radius: var(--home-radius, 16px);
  animation: ui-fade-in var(--motion-enter, 300ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.inbox-empty .empty-state__actions {
  margin-top: 0.25rem;
}

/* ——— Chat page ——— */

.chat-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: var(--color-primary-light, var(--home-primary-light, #e8eef4));
  color: var(--color-primary-deep, var(--home-primary-deep, #1f2d3d));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-page__head {
  transition:
    border-color var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    box-shadow var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.chat-page__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-pill, 9999px);
  color: var(--home-text-muted, #8a949b);
  transition:
    color var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    background var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.chat-page__back:hover {
  color: var(--home-primary, #2d3e50);
  background: var(--home-primary-light, #e8eef4);
}

.chat-messages {
  min-height: 16rem;
  max-height: calc(100vh - 22rem);
}

.chat-messages > .flex {
  animation: ui-fade-in var(--motion-enter, 300ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.chat-messages > .flex:nth-child(1) { animation-delay: 0.02s; }
.chat-messages > .flex:nth-child(2) { animation-delay: 0.04s; }
.chat-messages > .flex:nth-child(3) { animation-delay: 0.06s; }
.chat-messages > .flex:nth-child(4) { animation-delay: 0.08s; }
.chat-messages > .flex:nth-child(5) { animation-delay: 0.1s; }
.chat-messages > .flex:nth-child(6) { animation-delay: 0.12s; }
.chat-messages > .flex:nth-child(7) { animation-delay: 0.14s; }
.chat-messages > .flex:nth-child(8) { animation-delay: 0.16s; }
.chat-messages > .flex:nth-child(n+9) { animation-delay: 0.18s; }

.chat-bubble {
  max-width: 85%;
  padding: 0.625rem 1rem;
  border-radius: 1.125rem;
}

.chat-bubble--peer {
  background: var(--color-surface-tint, var(--home-bg, #f4f6f8));
  color: var(--home-text, var(--color-text));
  border-bottom-left-radius: 0.375rem;
}

.chat-bubble--mine {
  background: linear-gradient(135deg, var(--home-primary, #2d3e50) 0%, var(--home-primary-deep, #1f2d3d) 100%);
  color: #fff;
  border-bottom-right-radius: 0.375rem;
  box-shadow: 0 4px 14px rgba(45, 62, 80, 0.22);
}

.chat-bubble__time {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  opacity: 0.75;
  text-align: right;
}

.chat-bubble--peer .chat-bubble__time {
  text-align: left;
  color: var(--home-text-muted, #8a949b);
  opacity: 1;
}

.chat-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--home-text-secondary, #5f6b75);
  font-size: 0.875rem;
  animation: ui-fade-in var(--motion-enter, 300ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.chat-quick-reply {
  padding: 0.375rem 0.875rem;
  background: var(--home-surface, #fff);
  border: 1px solid var(--home-border-strong, #cfd6dd);
  border-radius: var(--radius-pill, 9999px);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--home-text, #212529);
  cursor: pointer;
  font-family: inherit;
  transition:
    background var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    border-color var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    color var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    transform var(--motion-instant, 100ms) var(--ease-press, cubic-bezier(0.2, 0, 0, 1));
}

.chat-quick-reply:hover {
  background: var(--home-primary-light, #e8eef4);
  border-color: var(--home-primary, #2d3e50);
  color: var(--home-primary, #2d3e50);
}

.chat-quick-reply:active {
  transform: translateY(1px);
}

.chat-input {
  font-family: inherit;
  transition:
    border-color var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    box-shadow var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    background var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.chat-input:focus {
  outline: none;
  border-color: var(--home-primary, #2d3e50);
  box-shadow: var(--home-focus-ring, 0 0 0 3px rgba(45, 62, 80, 0.16));
  background: #fff;
}

.chat-send-btn {
  width: 3rem;
  height: 3rem;
  background: var(--home-primary, #2d3e50);
  color: #fff;
  border: 1px solid var(--home-primary-deep, #1f2d3d);
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-btn, 0 1px 2px rgba(33, 37, 41, 0.18));
  transition:
    background var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    box-shadow var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    transform var(--motion-instant, 100ms) var(--ease-press, cubic-bezier(0.2, 0, 0, 1));
}

.chat-send-btn:hover {
  background: var(--home-primary-hover, #253545);
  box-shadow: var(--shadow-btn-hover, 0 2px 6px rgba(33, 37, 41, 0.2));
}

.chat-send-btn:active {
  background: var(--home-primary-deep, #1f2d3d);
  transform: translateY(1px);
}

/* Profile / shared conversation rows */

.chat-conv-item {
  display: block;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--home-border, #e2e6ea);
  text-decoration: none;
  color: inherit;
  transition:
    background var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
  animation: ui-fade-in var(--motion-enter, 300ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.chat-conv-item:nth-child(1) { animation-delay: 0.02s; }
.chat-conv-item:nth-child(2) { animation-delay: 0.04s; }
.chat-conv-item:nth-child(3) { animation-delay: 0.06s; }
.chat-conv-item:nth-child(4) { animation-delay: 0.08s; }
.chat-conv-item:nth-child(5) { animation-delay: 0.1s; }
.chat-conv-item:nth-child(6) { animation-delay: 0.12s; }
.chat-conv-item:nth-child(n+7) { animation-delay: 0.14s; }

.chat-conv-item:hover {
  background: var(--home-primary-light, #e8eef4);
}

.chat-conv-item--active {
  background: var(--color-primary-light, var(--home-primary-light, #e8eef4));
}

.chat-conv-item.flex {
  display: flex;
}

/* ——— Floating chat widget ——— */

.chat-widget {
  position: fixed;
  right: 1rem;
  bottom: calc(4.75rem + env(safe-area-inset-bottom, 0));
  z-index: 120;
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
}

@media (min-width: 768px) {
  .chat-widget {
    right: 1.5rem;
    bottom: 1.5rem;
  }
}

.chat-widget--page-hidden {
  display: none;
}

.chat-widget__fab {
  position: relative;
  width: 3.625rem;
  height: 3.625rem;
  border: none;
  border-radius: 9999px;
  background: linear-gradient(145deg, var(--home-primary, #2d3e50) 0%, var(--home-primary-deep, #1f2d3d) 100%);
  color: #ffffff;
  box-shadow:
    0 10px 32px rgba(45, 62, 80, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform var(--motion-slow, 250ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    box-shadow var(--motion-slow, 250ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.chat-widget__fab:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 16px 40px rgba(45, 62, 80, 0.5);
}

.chat-widget__fab[aria-expanded='true'] {
  transform: scale(0.94);
}

.chat-widget__badge {
  position: absolute;
  top: -0.125rem;
  right: -0.125rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3125rem;
  border-radius: 9999px;
  background: var(--home-danger, #b94a4a);
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
  border: 2px solid #ffffff;
}

.chat-widget__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.875rem);
  width: min(24rem, calc(100vw - 1.5rem));
  height: min(34rem, calc(100vh - 7rem));
  background: #ffffff;
  border-radius: 1.5rem;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow:
    0 28px 64px rgba(0, 0, 0, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
}

.chat-widget__panel.is-open {
  display: flex;
  animation: chat-widget-in var(--motion-enter, 300ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.chat-widget__panel[hidden] {
  display: none !important;
}

.chat-widget__panel--thread .chat-widget__dock {
  display: none;
}

.chat-widget__body[hidden],
.chat-widget__thread[hidden],
.chat-widget__guest[hidden],
.chat-widget__loading[hidden],
.chat-widget__empty[hidden],
.chat-widget__back[hidden],
.chat-widget__ad-bar[hidden],
.chat-widget__dock[hidden] {
  display: none !important;
}

@keyframes chat-widget-in {
  from {
    opacity: 0;
    transform: translateY(1rem) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-widget__header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 1rem 1rem 0.875rem;
  background: linear-gradient(135deg, var(--home-primary, #2d3e50) 0%, var(--home-primary-deep, #1f2d3d) 100%);
  color: #ffffff;
  flex-shrink: 0;
}

.chat-widget__header-text {
  flex: 1;
  min-width: 0;
}

.chat-widget__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.25;
  color: #ffffff;
}

.chat-widget__subtitle {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.88);
  margin: 0.125rem 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-widget__subtitle:empty {
  display: none;
}

.chat-widget__back,
.chat-widget__close {
  width: 2.125rem;
  height: 2.125rem;
  border: none;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    transform var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.chat-widget__back:hover,
.chat-widget__close:hover {
  background: rgba(255, 255, 255, 0.32);
  transform: scale(1.05);
}

.chat-widget__content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--home-primary-light, #e8eef4) 0%, #ffffff 32%);
}

.chat-widget__body,
.chat-widget__thread {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-widget__loading,
.chat-widget__empty,
.chat-widget__guest {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem 1rem;
  text-align: center;
  animation: ui-fade-in var(--motion-enter, 300ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.chat-widget__loading {
  color: var(--home-text, #212529);
  font-size: 0.875rem;
}

.chat-widget__guest-visual,
.chat-widget__empty-visual {
  margin-bottom: 1rem;
}

.chat-widget__guest-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 9999px;
  background: linear-gradient(145deg, var(--home-primary-light, #e8eef4) 0%, #ffffff 100%);
  box-shadow:
    0 8px 24px rgba(45, 62, 80, 0.12),
    0 0 0 1px rgba(45, 62, 80, 0.06);
}

.chat-widget__guest-icon,
.chat-widget__empty-icon {
  width: 2rem;
  height: 2rem;
  color: var(--home-primary, #2d3e50);
}

.chat-widget__guest-title,
.chat-widget__empty-title {
  margin: 0 0 0.375rem;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--home-text, #212529);
}

.chat-widget__guest-text,
.chat-widget__empty-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--home-text-secondary, #5f6b75);
  max-width: 16rem;
}

.chat-widget__empty-actions,
.chat-widget__guest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.25rem;
}

.chat-widget__guest-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.25rem;
  min-height: 2.75rem;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-lg, 1rem);
  background: var(--home-primary, #2d3e50);
  border: 1px solid var(--home-primary-deep, #1f2d3d);
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-btn, 0 1px 2px rgba(33, 37, 41, 0.18));
  transition:
    background var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    box-shadow var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    transform var(--motion-instant, 100ms) var(--ease-press, cubic-bezier(0.2, 0, 0, 1));
}

.chat-widget__guest-btn:hover {
  background: var(--home-primary-hover, #253545);
  box-shadow: var(--shadow-btn-hover, 0 2px 6px rgba(33, 37, 41, 0.2));
  color: #ffffff;
}

.chat-widget__guest-btn:active {
  background: var(--home-primary-deep, #1f2d3d);
  transform: translateY(1px);
}

.chat-widget__list {
  list-style: none;
  margin: 0;
  padding: 0.375rem 0;
  overflow-y: auto;
  flex: 1;
}

.chat-widget__list > li {
  animation: ui-fade-in var(--motion-enter, 300ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.chat-widget__list > li:nth-child(1) { animation-delay: 0.02s; }
.chat-widget__list > li:nth-child(2) { animation-delay: 0.04s; }
.chat-widget__list > li:nth-child(3) { animation-delay: 0.06s; }
.chat-widget__list > li:nth-child(4) { animation-delay: 0.08s; }
.chat-widget__list > li:nth-child(5) { animation-delay: 0.1s; }
.chat-widget__list > li:nth-child(6) { animation-delay: 0.12s; }
.chat-widget__list > li:nth-child(n+7) { animation-delay: 0.14s; }

.chat-widget__item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.chat-widget__item:hover {
  background: rgba(45, 62, 80, 0.06);
}

.chat-widget__item:focus-visible {
  outline: none;
  background: var(--home-primary-light, #e8eef4);
  box-shadow: inset 0 0 0 2px var(--home-primary, #2d3e50);
}

.chat-widget__item-avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background: linear-gradient(145deg, var(--home-primary-light, #e8eef4), #ffffff);
  color: var(--home-primary-deep, #1f2d3d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(45, 62, 80, 0.08);
}

.chat-widget__item-main {
  flex: 1;
  min-width: 0;
}

.chat-widget__item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.125rem;
}

.chat-widget__item-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--home-text, #212529);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-widget__item-time {
  font-size: 0.6875rem;
  color: var(--home-text-muted, #8a949b);
  flex-shrink: 0;
}

.chat-widget__item-ad {
  font-size: 0.75rem;
  color: var(--home-primary, #2d3e50);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.125rem;
}

.chat-widget__item-preview {
  font-size: 0.8125rem;
  color: var(--home-text-secondary, #5f6b75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-widget__item-preview--unread {
  color: var(--home-text, #212529);
  font-weight: 600;
}

.chat-widget__item-unread {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: var(--home-primary, #2d3e50);
  flex-shrink: 0;
  margin-top: 0.625rem;
}

.chat-widget__ad-bar {
  padding: 0.625rem 1rem;
  background: var(--home-primary-light, #e8eef4);
  border-bottom: 1px solid var(--home-border, #e2e6ea);
  flex-shrink: 0;
}

.chat-widget__ad-link {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--home-text, #212529);
  text-decoration: none;
  line-height: 1.35;
  transition: color var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.chat-widget__ad-link:hover {
  color: var(--home-primary, #2d3e50);
}

.chat-widget__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  background: var(--home-bg, #f4f6f8);
}

.chat-widget__bubble {
  max-width: 82%;
  padding: 0.625rem 0.875rem;
  border-radius: 1.125rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  word-break: break-word;
  animation: ui-fade-in var(--motion-enter, 300ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.chat-widget__bubble--peer {
  align-self: flex-start;
  background: #ffffff;
  color: var(--home-text, #212529);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-bottom-left-radius: 0.375rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chat-widget__bubble--mine {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--home-primary, #2d3e50) 0%, var(--home-primary-deep, #1f2d3d) 100%);
  color: #ffffff;
  border-bottom-right-radius: 0.375rem;
  box-shadow: 0 4px 14px rgba(45, 62, 80, 0.28);
}

.chat-widget__bubble-time {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.625rem;
  opacity: 0.72;
}

.chat-widget__composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: #ffffff;
  flex-shrink: 0;
}

.chat-widget__input {
  flex: 1;
  min-height: 2.625rem;
  max-height: 6rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 1.125rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--home-text, #212529);
  resize: none;
  line-height: 1.4;
  background: var(--home-bg, #f4f6f8);
  transition:
    border-color var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    box-shadow var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    background var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.chat-widget__input:focus {
  outline: none;
  border-color: var(--home-primary, #2d3e50);
  background: #ffffff;
  box-shadow: var(--home-focus-ring, 0 0 0 3px rgba(45, 62, 80, 0.16));
}

.chat-widget__send {
  width: 2.625rem;
  height: 2.625rem;
  border: none;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--home-primary, #2d3e50) 0%, var(--home-primary-deep, #1f2d3d) 100%);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    transform var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    box-shadow var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
  box-shadow: 0 4px 14px rgba(45, 62, 80, 0.3);
}

.chat-widget__send:hover {
  transform: scale(1.05);
}

.chat-widget__send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Dock — primary CTA only (no olive) */

.chat-widget__dock {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 0.125rem;
  padding: 0.5rem 0.625rem calc(0.625rem + env(safe-area-inset-bottom, 0));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.chat-widget__dock-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1875rem;
  min-width: 0;
  padding: 0.375rem 0.25rem;
  border-radius: 0.875rem;
  color: var(--home-text, #212529);
  text-decoration: none;
  transition:
    background var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    color var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    transform var(--motion-fast, 150ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.chat-widget__dock-btn:hover {
  background: rgba(45, 62, 80, 0.06);
  color: var(--home-primary, #2d3e50);
}

.chat-widget__dock-btn--accent {
  position: relative;
  top: -0.375rem;
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border-radius: 9999px;
  background: var(--home-primary, #2d3e50);
  color: #fff;
  border: 1px solid var(--home-primary-deep, #1f2d3d);
  box-shadow:
    0 6px 18px rgba(45, 62, 80, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.chat-widget__dock-btn--accent:hover {
  background: var(--home-primary-deep, #1f2d3d);
  color: #fff;
  transform: translateY(-2px);
}

.chat-widget__dock-btn--accent .chat-widget__dock-label {
  display: none;
}

.chat-widget__dock-icon {
  width: 1.375rem;
  height: 1.375rem;
  flex-shrink: 0;
}

.chat-widget__dock-btn--accent .chat-widget__dock-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.chat-widget__dock-label {
  font-size: 0.5625rem;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ——— Reduced motion ——— */

@media (prefers-reduced-motion: reduce) {
  .inbox-page__head,
  .inbox-list__item,
  .inbox-empty,
  .chat-messages > .flex,
  .chat-empty,
  .chat-conv-item,
  .chat-widget__panel.is-open,
  .chat-widget__loading,
  .chat-widget__empty,
  .chat-widget__guest,
  .chat-widget__list > li,
  .chat-widget__bubble {
    animation: none !important;
    animation-delay: 0s !important;
  }

  .chat-widget__fab:hover,
  .chat-widget__back:hover,
  .chat-widget__close:hover,
  .chat-widget__send:hover,
  .chat-widget__dock-btn--accent:hover,
  .chat-quick-reply:active,
  .chat-send-btn:active,
  .chat-widget__guest-btn:active {
    transform: none;
  }
}
