html,
body {
  height: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #f4f7f6;
  overflow: hidden;
}

#chatWindow {
  background: #ffffff;
  min-height: 0;
}

.message {
  max-width: 70%;
  padding: 0.75rem 0.9rem;
  border-radius: 0.4rem;
  margin-bottom: 0.75rem;
  white-space: pre-wrap;
  line-height: 1.4;
  font-size: 0.95rem;
  position: relative;
}

.message.in {
  background: #e8f1f3;
  align-self: flex-start;
}

.message.out {
  background: #b7f8c0;
  align-self: flex-end;
}

.message-meta {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 0.35rem;
  text-align: right;
}

.msg-ticks {
  margin-left: 6px;
  font-size: 0.75rem;
  vertical-align: middle;
}

.msg-ticks.single {
  color: #6c757d;
}

.msg-ticks.double {
  color: #4f9ef7;
}

.msg-loading {
  display: inline-block;
  margin-left: 6px;
  width: 6px;
  text-align: center;
  color: #6c757d;
  animation: msgPulse 1s infinite;
}

@keyframes msgPulse {
  0% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.3;
  }
}

.chat-stack {
  display: flex;
  flex-direction: column;
}

.chat-app {
  padding: 1rem;
}

.chat-card {
  background: #fff;
  border-radius: 0.55rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 10%);
  overflow: hidden;
}

.people-list {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 0 0 280px;
  max-width: 40%;
}

.chat {
  min-height: 0;
  flex: 1 1 auto;
  min-width: 0;
  border-left: 1px solid #eaeaea;
}

.chat-header {
  border-bottom: 2px solid #f4f7f6 !important;
}

.chat-history {
  background: #f4f7f6;
}

.chat-message {
  border-top: 2px solid #f4f7f6 !important;
}

#manualInput {
  resize: none;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  border-radius: 50%;
  background: #dee2e6;
  color: #495057;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1rem;
}

.avatar-md {
  width: 36px;
  height: 36px;
  font-size: 0.8rem;
}

.info-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f1f3f5;
  color: #0071e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.send-status {
  font-size: 0.75rem;
  color: #6c757d;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.send-status.show {
  opacity: 1;
}

#conversationList {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.brand-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid #f1f3f5;
  background: #fff;
}

.brand-footer .brand-logo {
  max-width: 160px;
}

#conversationList .list-group-item {
  border: none;
  border-radius: 0;
  padding: 0.75rem 1rem;
}

#conversationList .list-group-item {
  background: hsl(60, 100%, 99%);
}

#conversationList .list-group-item:nth-child(odd) {
  background: #e9f5fd;
}

#conversationList .list-group-item.active {
  background: #e6f7ee;
}

#conversationList .list-group-item.active .fw-semibold,
#conversationList .list-group-item.active .conversation-preview,
#conversationList .list-group-item.active .conversation-time {
  color: #212529;
}

#conversationList .list-group-item.active .conversation-preview,
#conversationList .list-group-item.active .conversation-time {
  color: #959a9e;
}

#conversationList .list-group-item-action:hover {
  background: #e0e0e0;
}

.conversation-item {
  display: flex;
  gap: 0.75rem;
}

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

.conversation-preview {
  color: #767b80;
}

.conversation-time {
  color: #adb5bd;
  font-size: 0.75rem;
}

.row.h-100 {
  flex-wrap: nowrap;
}

.gutter {
  display: none;
}

.unread-badge {
  background: #7adb9c;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.brand-logo {
  width: 100%;
  max-width: 213px;
  height: auto;
  max-height: 39px;
}

.qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.qr-modal-content {
  background: #fff;
  padding: 1rem;
  border-radius: 0.5rem;
  width: 320px;
  max-width: 90vw;
}

.qr-modal-content.qr-layout {
  width: 720px;
  max-width: 95vw;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.5rem;
}

.qr-left {
  display: flex;
  flex-direction: column;
}

.qr-steps {
  padding-left: 1.25rem;
  margin: 0 0 1rem;
}

.qr-steps li {
  margin-bottom: 0.5rem;
}

.qr-help {
  color: #198754;
  font-weight: 600;
  cursor: pointer;
}

.qr-loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border: 2px solid #ced4da;
  border-top-color: #198754;
  border-radius: 50%;
  animation: qrSpin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes qrSpin {
  to {
    transform: rotate(360deg);
  }
}

.qr-right {
  display: flex;
  align-items: center;
  justify-content: center;
}

.contract-modal {
  width: 720px;
  max-width: 95vw;
}

.contract-text {
  max-height: 50vh;
  overflow: auto;
  white-space: pre-wrap;
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #e6e6e6;
}

.qr-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.toast-container {
  position: fixed;
  right: 1rem;
  top: 1rem;
  z-index: 1050;
  pointer-events: none;
}

.toast-message {
  background: #198754;
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-message.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-message.toast-info {
  background: #25d366;
}
