.nav-badge {
  float: right;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--primary);
  text-align: center;
  font-size: .7rem;
  font-weight: 900;
}

.message-panel {
  max-width: 820px;
  min-height: 560px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(40,18,53,.09);
}

.message-recipient {
  display: grid;
  gap: 7px;
  font-size: .88rem;
  font-weight: 800;
}

.message-recipient select {
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid #d9cfe0;
  border-radius: 11px;
  background: #fff;
}

.message-thread {
  height: 350px;
  margin: 18px 0;
  padding: 18px;
  overflow-y: auto;
  border-radius: 14px;
  background: var(--soft);
}

.message-bubble {
  width: fit-content;
  max-width: min(78%, 540px);
  margin: 0 0 12px;
  padding: 11px 14px;
  border-radius: 15px 15px 15px 4px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(40,18,53,.07);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-bubble.mine {
  margin-left: auto;
  border-radius: 15px 15px 4px 15px;
  background: var(--primary);
  color: #fff;
}

.message-bubble small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: .7rem;
}

.message-bubble.mine small {
  color: rgba(255,255,255,.72);
}

.message-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.message-compose textarea {
  min-height: 76px;
  padding: 12px;
  border: 1px solid #d9cfe0;
  border-radius: 11px;
}

.message-compose button {
  min-width: 120px;
}

@media (max-width: 620px) {
  #messagesView .page-head button {
    width: 100%;
    margin-top: 14px;
  }

  .message-panel {
    min-height: 0;
    padding: 14px;
  }

  .message-thread {
    height: 52vh;
    min-height: 300px;
    padding: 12px;
  }

  .message-compose {
    grid-template-columns: 1fr;
  }

  .message-compose button {
    width: 100%;
  }
}
