:root {
  --bs-body-bg: #f0f2f5;
  --bs-body-color: #111b21;
  --bs-primary: #00a884;
  --bs-border-color: #d8dfe3;

  --wa-surface: #ffffff;
  --wa-surface-2: #f0f2f5;
  --wa-text: #111b21;
  --wa-text-muted: #667781;
  --wa-accent: #25d366;
  --wa-incoming: #ffffff;
  --wa-outgoing: #d9fdd3;
  --wa-border: #d8dfe3;
}

body.app-shell {
  min-height: 100%;
  background:
    radial-gradient(800px 400px at 100% -10%, rgba(37, 211, 102, 0.14), transparent 60%),
    #f0f2f5;
  color: var(--wa-text);
}

.app-topbar {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.92);
}

.app-brand,
.app-nav-link {
  color: var(--wa-text);
}

.app-nav-link:hover,
.app-brand:hover {
  color: #0c5f4a;
}

main.container {
  max-width: 1080px;
}

.app-footer-link {
  font-size: 0.9rem;
}

.app-legal-page {
  max-width: 760px;
}

.app-legal-page p {
  line-height: 1.7;
}

.card {
  background-color: #ffffff;
}

.form-control,
.form-select {
  background-color: #ffffff;
  border-color: var(--wa-border);
  color: var(--wa-text);
}

.form-control::placeholder {
  color: #8696a0;
}

.form-control:focus,
.form-select:focus {
  background-color: #ffffff;
  color: var(--wa-text);
  border-color: #8fd3c3;
  box-shadow: 0 0 0 0.2rem rgba(0, 168, 132, 0.12);
}

.wa-inbox-shell,
.wa-chat-shell {
  border: 1px solid var(--wa-border);
  border-radius: 1rem;
  background: var(--wa-surface);
  overflow: hidden;
}

.wa-chat-header {
  padding: 0.85rem 1rem;
  background: var(--wa-surface-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--wa-border);
}

.wa-chat-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--wa-text);
}

.wa-chat-title .wa-blocked-indicator--header {
  margin-left: 0.35rem;
  vertical-align: middle;
}

.wa-chat-heading {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.wa-chat-heading > div:last-child {
  min-width: 0;
}

.wa-chat-subtitle {
  font-size: 0.82rem;
  color: var(--wa-text-muted);
}

.wa-header-menu-button {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--wa-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
}

.wa-header-menu-button:hover,
.wa-header-menu-button:focus,
.wa-header-menu-button:active {
  color: var(--wa-text);
  background: rgba(17, 27, 33, 0.06);
  border-color: rgba(17, 27, 33, 0.08);
}

.wa-header-dropdown .dropdown-item {
  font-size: 0.92rem;
}

.wa-name-editor summary {
  list-style: none;
  cursor: pointer;
}

.wa-name-editor summary::-webkit-details-marker {
  display: none;
}

.wa-name-form {
  margin-top: 0.35rem;
  display: flex;
  gap: 0.35rem;
}

.wa-search-form {
  padding: 0.85rem 1rem 0;
}

.wa-search-input {
  border-radius: 0.7rem;
  background: #f6f7f8;
  border: 1px solid var(--wa-border);
}

.wa-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.75rem 1rem 0.9rem;
}

.wa-pill {
  border: 1px solid var(--wa-border);
  background: #f6f7f8;
  color: var(--wa-text-muted);
  text-decoration: none;
  border-radius: 999px;
  padding: 0.38rem 0.85rem;
  font-size: 0.82rem;
  line-height: 1.2;
}

.wa-pill:hover {
  color: var(--wa-text);
}

.wa-pill.is-active {
  background: #d9fdd3;
  border-color: #b7ebcc;
  color: #1f7a4f;
}

.wa-thread-list {
  border-top: 1px solid var(--wa-border);
}

.wa-thread-row {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #edf1f3;
  color: inherit;
}

.wa-thread-row:hover {
  background: #f7f9fa;
}

.wa-thread-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  font-size: 0.72rem;
  color: var(--wa-text-muted);
  background: #f8fafb;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wa-thread-divider::before,
.wa-thread-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #dde4e8;
}

.wa-thread-divider span {
  white-space: nowrap;
}

.wa-avatar {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex: 0 0 auto;
  position: relative;
  overflow: visible;
}

.wa-avatar-flag {
  position: absolute;
  right: -0.18rem;
  bottom: -0.18rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  font-size: 0.66rem;
  line-height: 1;
  z-index: 2;
  pointer-events: none;
}

.wa-channel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wa-channel-icon--instagram {
  color: #e4405f;
}

.wa-channel-icon-svg {
  width: 0.72rem;
  height: 0.72rem;
  display: block;
}

.wa-avatar--bot {
  background: linear-gradient(135deg, #1877f2, #0e4977);
}

.wa-avatar--operator {
  background: linear-gradient(135deg, #00a884, #0a5a4a);
}

.wa-thread-content {
  min-width: 0;
  flex: 1;
}

.wa-thread-topline,
.wa-thread-bottomline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.wa-thread-name {
  font-size: 0.94rem;
  margin: 0;
  color: var(--wa-text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-thread-indicators {
  margin-left: 0.35rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.wa-thread-time {
  color: var(--wa-text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.wa-thread-preview {
  color: var(--wa-text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-unread-count {
  display: inline-flex;
  min-width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  justify-content: center;
  align-items: center;
  padding: 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--wa-accent);
  color: #ffffff;
  white-space: nowrap;
}

.wa-blocked-indicator {
  width: 0.92rem;
  height: 0.92rem;
  border-radius: 999px;
  border: 2px solid #d93025;
  background: transparent;
  display: inline-block;
  flex: 0 0 auto;
}

.wa-blocked-indicator--header {
  width: 0.82rem;
  height: 0.82rem;
}

.wa-empty-state {
  color: var(--wa-text-muted);
  padding: 1.1rem 1rem;
  font-size: 0.9rem;
}

.wa-load-more-wrap {
  padding: 0.9rem 1rem 1.1rem;
  display: grid;
  justify-items: center;
  gap: 0.5rem;
}

.wa-load-more-wrap.is-hidden {
  display: none;
}

.wa-load-more-button {
  min-width: 16rem;
}

.wa-load-more-sentinel {
  width: 100%;
  height: 1px;
}

.wa-chat-heading {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.wa-back-link {
  color: var(--wa-text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  border: 1px solid var(--wa-border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  background: #ffffff;
}

.wa-back-link:hover {
  color: var(--wa-text);
}

.wa-chat-controls {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--wa-border);
  background: #ffffff;
}

.wa-chat-meta-line {
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  color: var(--wa-text-muted);
}

.wa-chat-controls .wa-pill-row {
  padding: 0;
  margin-bottom: 0.7rem;
}

.wa-switch-card {
  background: #f6f7f8;
  border: 1px solid var(--wa-border);
  border-radius: 0.7rem;
  padding: 0.55rem 0.75rem;
}

.wa-switch-card .form-check-label {
  color: var(--wa-text);
  font-size: 0.86rem;
}

.wa-switch-card .form-check-input {
  border-color: var(--wa-border);
}

.wa-switch-card .form-check-input:checked {
  background-color: #00a884;
  border-color: #00a884;
}

.wa-conversation-area {
  display: flex;
  flex-direction: column;
  min-height: min(68vh, 42rem);
  background-color: #efeae2;
  background-image: radial-gradient(rgba(17, 27, 33, 0.055) 1px, transparent 1px);
  background-size: 14px 14px;
}

.wa-messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.wa-day-separator {
  display: flex;
  justify-content: center;
  margin: 0.55rem 0 0.65rem;
}

.wa-day-separator-label {
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  color: rgba(0, 0, 0, 0.6);
  padding: 0.12rem 0.52rem;
  font-size: 0.72rem;
  line-height: 1.4;
}

.wa-message-row {
  display: flex;
  margin-bottom: 0.45rem;
}

.wa-message-row.is-incoming {
  justify-content: flex-start;
}

.wa-message-row.is-outgoing {
  justify-content: flex-end;
}

.wa-bubble {
  max-width: min(88%, 34rem);
  border-radius: 0.75rem;
  padding: 0.55rem 0.7rem 0.35rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

.wa-bubble--incoming {
  background: var(--wa-incoming);
}

.wa-bubble--outgoing {
  background: var(--wa-outgoing);
}

.wa-bubble--audio {
  width: min(100%, 21rem);
}

.wa-bubble-body p {
  margin-bottom: 0.35rem;
}

.wa-bubble-body ul,
.wa-bubble-body ol,
.wa-bubble-body blockquote,
.wa-bubble-body pre {
  margin-bottom: 0.35rem;
}

.wa-bubble-body > :last-child {
  margin-bottom: 0;
}

.wa-bubble-body ul,
.wa-bubble-body ol {
  padding-left: 1.2rem;
}

.wa-bubble-body blockquote {
  border-left: 3px solid rgba(17, 27, 33, 0.18);
  padding-left: 0.65rem;
  color: inherit;
}

.wa-bubble-body pre {
  background: rgba(17, 27, 33, 0.08);
  border-radius: 0.45rem;
  padding: 0.45rem 0.55rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.wa-bubble-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.wa-bubble-body--media {
  display: grid;
  gap: 0.45rem;
}

.wa-media-audio {
  width: 100%;
  max-width: 20rem;
  min-width: 16rem;
  display: block;
}

.wa-media-link {
  display: inline-block;
}

.wa-media-image {
  display: block;
  max-width: min(100%, 20rem);
  max-height: 18rem;
  border-radius: 0.6rem;
  object-fit: cover;
}

.wa-media-image--sticker {
  max-width: 9rem;
  max-height: 9rem;
  object-fit: contain;
}

.wa-media-document-title {
  margin: 0;
  font-weight: 600;
  font-size: 0.88rem;
  word-break: break-word;
}

.wa-media-document-link {
  font-size: 0.82rem;
}

.wa-media-video {
  display: block;
  width: min(100%, 20rem);
  max-height: 18rem;
  border-radius: 0.6rem;
}

.wa-media-status {
  font-size: 0.74rem;
  color: var(--wa-text-muted);
}

.wa-bubble-meta {
  text-align: right;
  font-size: 0.7rem;
  color: #667781;
}

.wa-composer-wrap {
  border-top: 1px solid var(--wa-border);
  background: var(--wa-surface-2);
  padding: 0.65rem 0.8rem;
}

.wa-composer-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wa-composer-row {
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
  width: 100%;
}

.wa-composer-actions {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex: 0 0 auto;
}

.wa-composer-actions.is-hidden {
  display: none;
}

.wa-action-button {
  border: 1px solid var(--wa-border);
  background: #ffffff;
  border-radius: 999px;
  min-width: 2.35rem;
  height: 2.35rem;
  line-height: 1;
  padding: 0;
}

.wa-action-button:hover {
  background: #f1f4f5;
}

.wa-composer-input {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  min-height: 2.35rem;
  max-height: 11rem;
  border-radius: 1rem;
  background: #ffffff;
}

.wa-send-button {
  background: #00a884;
  color: #ffffff;
  border: 0;
  border-radius: 999px;
  min-width: 2.35rem;
  width: 2.35rem;
  height: 2.35rem;
  line-height: 1;
  padding: 0;
  font-weight: 600;
}

.wa-send-button.is-hidden {
  display: none;
}

.wa-send-button--mic {
  font-size: 1rem;
}

.wa-send-button.is-recording {
  background: #d92d20;
}

.wa-send-button.is-recording:hover {
  background: #b42318;
}

.wa-send-button--cancel {
  background: #ffffff;
  border: 1px solid var(--wa-border);
  color: var(--wa-text);
  font-size: 1rem;
}

.wa-send-button--cancel:hover {
  background: #f1f4f5;
  color: var(--wa-text);
}

.wa-send-button:hover {
  background: #1a9178;
  color: #ffffff;
}

.wa-send-button:disabled,
.wa-composer-input:disabled {
  opacity: 0.75;
}

.wa-composer-note {
  color: var(--wa-text-muted);
  font-size: 0.75rem;
  margin-top: 0.45rem;
}

.wa-composer-note--status {
  margin-top: 0;
}

.wa-composer-note--status.is-error {
  color: #b42318;
}

.wa-budget-file {
  display: block;
  font-size: 0.73rem;
  color: var(--wa-text-muted);
}

.wa-upload-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.wa-modal-note {
  font-size: 0.8rem;
  color: var(--wa-text-muted);
  margin-bottom: 0.65rem;
}

@media (max-width: 991.98px) {
  main.container {
    max-width: 100%;
  }

  .wa-inbox-shell,
  .wa-chat-shell {
    border-radius: 0.8rem;
  }

  .wa-conversation-area {
    min-height: 70vh;
  }
}

@media (max-width: 575.98px) {
  .wa-chat-header,
  .wa-search-form,
  .wa-pill-row,
  .wa-chat-controls,
  .wa-thread-row,
  .wa-thread-divider,
  .wa-messages-scroll,
  .wa-composer-wrap {
    padding-left: 0.72rem;
    padding-right: 0.72rem;
  }

  .wa-thread-name {
    font-size: 0.9rem;
  }

  .wa-thread-preview {
    font-size: 0.78rem;
  }

  .wa-bubble {
    max-width: 92%;
  }

  .wa-bubble--audio {
    width: min(100%, 20rem);
  }

  .wa-media-audio {
    min-width: 0;
  }
}
