:root {
  /* Pastel, Signal-inspired palette (soft blue/lavender), not WhatsApp green. */
  --bg: #e9edf7;
  --header: #6d82d6;
  --header-text: #ffffff;
  --sent: #dbe4fb; /* sent = calm pastel blue */
  --pending: #fdeec5; /* pending = warm pastel amber */
  --error-dot: #ec7a76; /* error = soft coral, still reads as a warning */
  --text: #1b1e26;
  --meta: #6b7280;
  --composer-bg: #eef1f9;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top));
  background: var(--header);
  color: var(--header-text);
  flex: 0 0 auto;
}

.header__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.dest-toggle {
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: transparent;
  color: var(--header-text);
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.dest-toggle[data-dest="carto"] {
  background: rgba(255, 255, 255, 0.18);
}

/* --- Messages list --- */
.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.day-sep {
  align-self: center;
  background: rgba(255, 255, 255, 0.75);
  color: var(--meta);
  font-size: 0.75rem;
  padding: 0.2rem 0.7rem;
  border-radius: 0.5rem;
  margin: 0.5rem 0;
}

.row {
  display: flex;
  justify-content: flex-end;
}

.bubble {
  position: relative;
  max-width: 80%;
  background: var(--sent);
  border-radius: 0.6rem;
  padding: 0.45rem 0.6rem;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

.bubble--pending {
  background: var(--pending);
}

.bubble--error {
  background: var(--sent);
}

.bubble--error::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--error-dot);
}

.bubble--clickable {
  cursor: pointer;
}

.bubble__text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
  line-height: 1.35;
}

.bubble__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.bubble__dest {
  font-size: 0.7rem;
  color: var(--meta);
}

.bubble__time {
  font-size: 0.68rem;
  color: var(--meta);
}

.bubble__retry {
  display: block;
  margin-top: 0.35rem;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  color: #333;
  border-radius: 0.4rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
}

/* --- Composer --- */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.5rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
  background: var(--composer-bg);
  flex: 0 0 auto;
}

.composer__input {
  flex: 1 1 auto;
  resize: none;
  border: none;
  border-radius: 1.25rem;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.35;
  max-height: 160px;
  outline: none;
}

.composer__send {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--header);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}
