.chatw-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999999;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Ubuntu,
    Cantarell,
    Noto Sans,
    sans-serif;
  --chatw-blue: #2d8cff;
  --chatw-blue-dark: #1f6fe0;
  --chatw-bg: #f2f6fb;
  --chatw-card: #ffffff;
  --chatw-text: #0f172a;
  --chatw-muted: rgba(15, 23, 42, 0.6);
  --chatw-border: rgba(15, 23, 42, 0.08);
  --chatw-shadow: 0 26px 60px rgba(15, 23, 42, 0.22);
}

.chatw-widget * {
  box-sizing: border-box;
}

.chatw-hidden {
  display: none !important;
}

.chatw-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.chatw-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(2px);
}
.chatw-modal-card {
  position: relative;
  width: min(520px, calc(100vw - 36px));
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.35);
  padding: 16px 16px;
}
.chatw-modal-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--chatw-text);
}
.chatw-modal-text {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.75);
  line-height: 1.35;
}
.chatw-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.chatw-modal-btn {
  flex: 1;
  min-width: 180px;
  border-radius: 14px;
  padding: 12px 12px;
  font-weight: 900;
  cursor: pointer;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #fff;
  color: var(--chatw-text);
}
.chatw-modal-btn-primary {
  border: none;
  background: var(--chatw-blue);
  color: #fff;
}
.chatw-modal-cancel {
  margin-top: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: rgba(15, 23, 42, 0.75);
  font-weight: 900;
  cursor: pointer;
  padding: 10px 0 0;
}

.chatw-toggle {
  position: relative;
  background: #fff;
  color: var(--chatw-text);
  border: 1px solid var(--chatw-border);
  width: 62px;
  height: 62px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatw-toggle:before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  border: 2px solid rgba(37, 211, 102, 0.55);
}

.chatw-toggle:active {
  transform: translateY(1px);
}

.chatw-toggle-logo {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.06);
}

.chatw-toggle-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chatw-toggle-icon {
  line-height: 1;
  font-size: 18px;
}

.chatw-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  font-weight: 900;
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 2px solid #fff;
}

.chatw-box {
  position: fixed;
  right: 18px;
  bottom: 92px;
  width: min(380px, calc(100vw - 36px));
  height: min(580px, calc(100vh - 130px));
  background: var(--chatw-card);
  border-radius: 28px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--chatw-shadow);
  border: 1px solid var(--chatw-border);
}

.chatw-box.chatw-active {
  display: flex;
}

.chatw-header {
  background: linear-gradient(
    180deg,
    var(--chatw-blue),
    var(--chatw-blue-dark)
  );
  color: #fff;
  padding: 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chatw-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatw-hicon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatw-hicon svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: #ffffff;
}

.chatw-title strong {
  display: block;
  line-height: 1.05;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.chatw-title small {
  display: block;
  opacity: 0.95;
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

.chatw-close {
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.7);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chatw-status {
  background: #ffffff;
  border-bottom: 1px solid var(--chatw-border);
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chatw-chip {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--chatw-text);
}

.chatw-alert {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--chatw-border);
}

.chatw-alert strong {
  display: block;
}

.chatw-alert span {
  display: block;
  margin-top: 2px;
}

.chatw-alert-warning {
  background: #fff7ed;
  color: #7c2d12;
}

.chatw-alert-success {
  background: #ecfdf5;
  color: #065f46;
}

.chatw-prayer-cta {
  padding: 12px 14px;
  border-bottom: 1px solid var(--chatw-border);
  background: linear-gradient(180deg, rgba(255, 247, 237, 0.95), rgba(255, 255, 255, 0.98));
}

.chatw-prayer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  text-decoration: none;
  background: linear-gradient(135deg, #111827, #7c4b18, #f0ad3d);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(146, 80, 24, 0.18);
}

.chatw-prayer-link:hover {
  color: #fff;
  opacity: 0.96;
}

.chatw-prayer-icon {
  font-size: 15px;
  line-height: 1;
}

.chatw-prayer-cta small {
  display: block;
  margin-top: 8px;
  color: rgba(15, 23, 42, 0.68);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.chatw-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--chatw-bg);
  padding: 18px 16px;
}

.chatw-messages::-webkit-scrollbar {
  width: 6px;
}
.chatw-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chatw-messages::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.2);
  border-radius: 10px;
}
.chatw-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.4);
}

.chatw-msg {
  display: flex;
  gap: 10px;
  margin: 12px 0;
  align-items: flex-end;
}

.chatw-msg.me {
  justify-content: flex-end;
}
.chatw-msg.other,
.chatw-msg.system {
  justify-content: flex-start;
}
.chatw-msg.system {
  justify-content: center;
}
.chatw-msg.system .chatw-bubble {
  background: #111827;
  color: #ffffff;
  border: none;
  max-width: min(620px, 92%);
}
.chatw-msg.system .chatw-bubble-text {
  color: #ffffff;
  font-weight: 900;
}
.chatw-msg.system .chatw-bubble .chatw-meta {
  color: rgba(255, 255, 255, 0.75);
}

.chatw-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid rgba(15, 23, 42, 0.08);
  background: rgba(15, 23, 42, 0.04);
  flex: 0 0 34px;
}
.chatw-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chatw-bubble {
  max-width: min(560px, 86%);
  padding: 14px 16px 36px;
  border-radius: 18px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
  position: relative;
}
.chatw-bubble-system {
  padding: 14px 16px 34px;
}

.chatw-msg.me .chatw-bubble {
  background: var(--chatw-blue-dark);
  color: #fff;
}

.chatw-msg.other .chatw-bubble,
.chatw-msg.system .chatw-bubble {
  background: #ffffff;
  color: var(--chatw-text);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.chatw-bubble-text {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  white-space: pre-wrap;
}

.chatw-msg.other .chatw-bubble-text,
.chatw-msg.system .chatw-bubble-text {
  color: #1f2a44;
}

.chatw-file-card {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 12px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.chatw-msg.other .chatw-file-card,
.chatw-msg.system .chatw-file-card {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.chatw-file-ico {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  font-size: 16px;
}

.chatw-msg.other .chatw-file-ico,
.chatw-msg.system .chatw-file-ico {
  background: rgba(15, 23, 42, 0.06);
}

.chatw-file-name {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  word-break: break-word;
}

.chatw-file-link {
  display: inline-flex;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  color: inherit;
  opacity: 0.9;
}

.chatw-bubble .chatw-meta {
  position: absolute;
  right: 12px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 900;
  opacity: 0.88;
}

.chatw-msg.me .chatw-bubble .chatw-meta {
  color: rgba(255, 255, 255, 0.9);
}

.chatw-msg.other .chatw-bubble .chatw-meta,
.chatw-msg.system .chatw-bubble .chatw-meta {
  color: rgba(15, 23, 42, 0.55);
}

.chatw-msg-status {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.chatw-foot {
  background: #ffffff;
  border-top: 1px solid var(--chatw-border);
  padding: 12px 12px 14px;
}

.chatw-foot-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.chatw-check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: rgba(15, 23, 42, 0.7);
  font-weight: 800;
}

.chatw-cpf {
  flex: 1;
  min-width: 170px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--chatw-text);
  background: #ffffff;
}
.chatw-member-wrap {
  width: 100%;
}
.chatw-member-loading {
  font-size: 12px;
  font-weight: 900;
  color: rgba(15, 23, 42, 0.6);
  padding: 6px 2px 0;
}
.chatw-member-error {
  font-size: 12px;
  font-weight: 900;
  color: #b91c1c;
  padding: 6px 2px 0;
}
.chatw-member-card {
  margin-top: 8px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 10px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.chatw-member-input {
  flex: 1;
  min-width: 220px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 900;
  color: var(--chatw-text);
  background: #ffffff;
  outline: none;
}
.chatw-member-photo {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.08);
  object-fit: cover;
}
.chatw-member-confirm {
  border: none;
  background: var(--chatw-blue);
  color: #fff;
  font-weight: 900;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.chatw-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chatw-attach {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(15, 23, 42, 0.08);
  user-select: none;
  color: rgba(15, 23, 42, 0.75);
  font-size: 18px;
}

.chatw-file {
  display: none;
}

.chatw-text {
  flex: 1;
  border: 2px solid rgba(45, 140, 255, 0.25);
  border-radius: 18px;
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
  background: #ffffff;
  color: var(--chatw-text);
  caret-color: var(--chatw-blue-dark);
}
.chatw-text::placeholder {
  color: rgba(15, 23, 42, 0.45);
}

.chatw-send {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: none;
  background: var(--chatw-blue);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatw-error {
  margin-top: 8px;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 420px) {
  .chatw-box {
    right: 12px;
    bottom: 86px;
    width: calc(100vw - 24px);
    height: calc(100vh - 120px);
    border-radius: 24px;
  }
  .chatw-title strong {
    font-size: 24px;
  }
  .chatw-msg-avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
  .chatw-member-input {
  .chatw-member-input {
    min-width: 0;
    width: 100%;
  }
  .chatw-member-confirm {
    width: 100%;
  }
}
