:root {
  color-scheme: light;
  --cw-blue: #2378ff;
  --cw-indigo: #5148f7;
  --cw-violet: #8e35e9;
  --cw-ink: #16233d;
  --cw-muted: #7b88aa;
  --cw-surface: #f7f9ff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
#corpogram-webchat-root {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: transparent;
  color: var(--cw-ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

.cw-launch {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 4;
  display: grid;
  width: 62px;
  height: 62px;
  padding: 13px;
  overflow: visible;
  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cw-blue) 3%, var(--cw-indigo) 56%, var(--cw-violet));
  box-shadow: 0 12px 28px rgba(66, 66, 226, 0.35), 0 0 0 5px rgba(95, 95, 235, 0.08);
  cursor: pointer;
  transition: opacity 140ms ease, visibility 140ms ease, transform 160ms ease, box-shadow 160ms ease;
  place-items: center;
}

.cw-open .cw-launch {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.cw-launch:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(66, 66, 226, 0.4), 0 0 0 6px rgba(95, 95, 235, 0.1);
}

.cw-launch-icon {
  display: grid;
  width: 32px;
  height: 32px;
  color: #ffffff;
  place-items: center;
}

.cw-launch-icon svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.cw-launch-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 13px;
  height: 13px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #bf42ef;
  box-shadow: 0 0 0 3px rgba(191, 66, 239, 0.18);
}

.cw-panel {
  position: absolute;
  inset: 2px;
  z-index: 2;
  display: none;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  min-width: 0;
  overflow: hidden;
  grid-template-rows: 74px minmax(0, 1fr) auto;
  border: 1px solid rgba(116, 129, 190, 0.2);
  border-radius: 24px;
  background: var(--cw-surface);
  box-shadow: 0 24px 70px rgba(54, 58, 154, 0.24), 0 0 30px rgba(102, 82, 240, 0.11);
  font-size: 14px;
  line-height: 1.45;
}

.cw-panel.open {
  display: grid;
}

.cw-head {
  position: relative;
  z-index: 2;
  display: flex;
  height: 108px;
  min-width: 0;
  align-items: flex-start;
  gap: 16px;
  padding: 17px 18px 35px;
  overflow: visible;
  pointer-events: none;
  background: transparent;
  color: #ffffff;
}

.cw-head-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cw-head-gradient {
  width: 700px;
  height: 108px;
  background:
    radial-gradient(ellipse 58% 66% at 7% -4%, rgba(157, 151, 255, 0.28) 0%, rgba(157, 151, 255, 0.11) 36%, rgba(157, 151, 255, 0) 69%),
    linear-gradient(105deg, #1c82fd 0%, #2a70f8 16%, #3a61f4 32%, #484ceb 52%, #5241e7 67%, #563adf 79%, #5431cf 90%, #4e2aba 100%);
}

.cw-head-wave {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 34px;
  pointer-events: none;
}

.cw-wave-accent {
  fill: url("#cw-wave-accent-gradient");
}

.cw-brand-avatar {
  position: relative;
  z-index: 1;
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  padding: 4px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 7px 20px rgba(32, 53, 143, 0.2);
  place-items: center;
}

.cw-brand-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: saturate(1.35) contrast(1.08);
}

.cw-brand-avatar > span {
  position: absolute;
  right: -1px;
  bottom: 2px;
  width: 13px;
  height: 13px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #34dda0;
}

.cw-head-copy {
  z-index: 1;
  min-width: 0;
  flex: 1 1 auto;
  padding-top: 3px;
}

.cw-title {
  overflow: hidden;
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cw-status {
  display: flex;
  align-items: center;
  margin-top: 2px;
  color: #70efba;
  font-size: 13px;
  line-height: 18px;
}

.cw-head-action,
.cw-close {
  position: relative;
  z-index: 1;
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  pointer-events: auto;
  place-items: center;
}

.cw-head-action {
  margin-left: auto;
  font-size: 25px;
  line-height: 1;
}

.cw-close {
  margin-left: -4px;
  font-size: 31px;
  font-weight: 300;
  line-height: 1;
}

.cw-head-action:hover,
.cw-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.cw-head-action[hidden],
.cw-identity[hidden],
.cw-emoji-panel[hidden] {
  display: none;
}

.cw-message-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(145deg, var(--cw-surface) 0%, #f4f6fd 54%, #f8f9ff 100%);
}

.cw-messages {
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 46px 18px 18px;
  background: transparent;
  scrollbar-width: none;
}

.cw-messages::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.cw-messages.cw-history-loading::before {
  content: "";
  position: sticky;
  z-index: 4;
  top: 0;
  display: block;
  width: 34px;
  height: 3px;
  margin: 0 auto -3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #2789ff, #8b3ff0);
  animation: cw-history-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes cw-history-pulse {
  from { opacity: 0.35; transform: scaleX(0.72); }
  to { opacity: 0.95; transform: scaleX(1); }
}

.cw-scrollbar {
  position: absolute;
  top: 40px;
  right: 3px;
  bottom: 12px;
  z-index: 4;
  width: 8px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.cw-scrollbar.active {
  opacity: 1;
  pointer-events: auto;
}

.cw-scrollbar-thumb {
  position: absolute;
  top: 0;
  right: 1px;
  display: block;
  width: 5px;
  height: 0;
  min-height: 36px;
  border-radius: 999px;
  background: #aeb9d7;
  cursor: grab;
  touch-action: none;
  transition: background-color 120ms ease;
}

.cw-scrollbar-thumb:hover,
.cw-scrollbar-thumb.dragging {
  background: #909dbc;
}

.cw-scrollbar-thumb.dragging {
  cursor: grabbing;
}

.cw-divider {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  color: #7583a7;
  font-size: 11px;
  line-height: 18px;
}

.cw-date-divider span {
  padding: 5px 14px;
  border: 1px solid rgba(135, 146, 191, 0.11);
  border-radius: 999px;
  background: rgba(233, 236, 248, 0.82);
  box-shadow: inset 0 0 0 1px rgba(138, 148, 190, 0.04);
}

.cw-date-divider {
  margin-bottom: 7px;
}

.cw-new-divider {
  gap: 11px;
  margin: 3px 0;
  color: #6456e9;
  font-weight: 600;
}

.cw-new-divider::before,
.cw-new-divider::after {
  height: 1px;
  flex: 1 1 auto;
  background: #d7d4f8;
  content: "";
}

.cw-message {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: flex-end;
  gap: 9px;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cw-message-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  align-self: flex-start;
  border: 1px solid rgba(107, 119, 167, 0.12);
  border-radius: 50%;
  background-color: #ffffff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: 0 6px 17px rgba(48, 61, 119, 0.12);
}

.cw-message-content {
  position: relative;
  min-width: 0;
  max-width: 82%;
  padding: 11px 13px;
  border-radius: 17px;
}

.cw-message-text {
  display: block;
  min-width: 0;
  color: inherit;
  font-size: 14px;
  line-height: 20px;
}

.cw-message-content.cw-has-attachment {
  width: 250px;
  min-width: 0;
  flex: 0 1 250px;
  align-items: stretch;
  flex-direction: column;
  gap: 7px;
}

.cw-attachment-card {
  display: block;
  width: 100%;
  min-width: 0;
  color: inherit;
  cursor: default;
}

.cw-attachment-preview {
  display: grid;
  width: 100%;
  min-height: 0;
  aspect-ratio: auto;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  place-items: center;
}

.cw-in .cw-attachment-preview {
  background: #eef1fb;
  color: #5267eb;
}

.cw-attachment-preview svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.cw-attachment-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cw-attachment-card.cw-image-ready .cw-attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cw-attachment-card.cw-preview-loading .cw-attachment-preview {
  opacity: 1;
}

.cw-message-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 3px;
  color: #8995b4;
  font-size: 10px;
  line-height: 14px;
  white-space: nowrap;
}

.cw-in {
  justify-content: flex-start;
}

.cw-in .cw-message-content {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid rgba(112, 126, 174, 0.11);
  background: #ffffff;
  box-shadow: 0 9px 25px rgba(42, 55, 110, 0.11);
}

.cw-in .cw-message-meta {
  position: static;
}

.cw-in.cw-multiline {
  padding-bottom: 16px;
}

.cw-in.cw-multiline .cw-message-content {
  display: block;
}

.cw-in.cw-multiline .cw-message-meta {
  position: absolute;
  bottom: -18px;
  left: 13px;
}

.cw-out {
  justify-content: flex-end;
}

.cw-out .cw-message-content {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  background: linear-gradient(135deg, #5267fb 0%, #4353f1 62%, #5342ed 100%);
  box-shadow: 0 9px 23px rgba(68, 75, 221, 0.25);
  color: #ffffff;
}

.cw-out .cw-message-text {
  min-width: 0;
  flex: 1 1 auto;
}

.cw-out .cw-message-meta {
  color: #c9d3ff;
}

.cw-out.cw-multiline .cw-message-content {
  align-items: stretch;
  flex-direction: column;
  gap: 3px;
}

.cw-out.cw-multiline .cw-message-meta {
  align-self: flex-end;
}

.cw-delivery {
  display: inline-grid;
  min-width: 16px;
  height: 12px;
  align-items: center;
  color: #c5ddff;
  font-size: 11px;
  justify-items: start;
}

.cw-delivery svg {
  display: block;
  width: 17px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.cw-pending {
  opacity: 0.62;
}

.cw-failed .cw-message-content {
  outline: 2px solid #d84c68;
  outline-offset: 1px;
}

.cw-compose {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 9px;
  padding: 11px 18px 14px;
  border-top: 1px solid rgba(122, 135, 181, 0.11);
  background: #f8f9fe;
}

.cw-identity {
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 0;
}

.cw-identity-label {
  display: block;
  margin: 0 0 6px 3px;
  color: #68779c;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}

.cw-identity-fields {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.cw-name {
  width: 100%;
  min-width: 0;
  height: 50px;
  padding: 13px 59px 13px 15px;
  border: 2px solid #dce1f1;
  border-radius: 16px;
  background: #ffffff;
  color: var(--cw-ink);
  font-size: 14px;
  line-height: 20px;
  outline: 0;
  box-shadow: 0 6px 18px rgba(47, 60, 121, 0.07), inset 0 0 0 1px rgba(117, 126, 173, 0.03);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.cw-name:focus {
  border-color: #9492ef;
  box-shadow: 0 0 0 2px rgba(92, 93, 234, 0.1), 0 7px 20px rgba(47, 60, 121, 0.09);
}

.cw-name-save {
  position: absolute;
  top: 5px;
  right: 8px;
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #706dfd 0%, #744df4 56%, #b33be5 100%);
  box-shadow: 0 7px 18px rgba(104, 71, 230, 0.34), 0 0 0 3px rgba(119, 91, 243, 0.06);
  color: #ffffff;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
  place-items: center;
}

.cw-name-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 17px rgba(75, 73, 222, 0.32);
}

.cw-name-save svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.cw-input-shell {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 54px;
  align-items: flex-end;
  border: 2px solid #dce1f1;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 7px 20px rgba(47, 60, 121, 0.09), inset 0 0 0 1px rgba(117, 126, 173, 0.03);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.cw-input-shell:focus-within {
  border-color: #9492ef;
  box-shadow: 0 0 0 2px rgba(92, 93, 234, 0.1), 0 8px 22px rgba(47, 60, 121, 0.11);
}

.cw-input {
  width: 100%;
  min-width: 0;
  height: 50px;
  min-height: 50px;
  max-height: 112px;
  padding: 14px 142px 12px 14px;
  resize: none;
  overflow-y: auto;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: var(--cw-ink);
  font-size: 14px;
  line-height: 20px;
  outline: 0;
}

.cw-name::placeholder,
.cw-input::placeholder {
  color: #8994b2;
}

.cw-compose-actions {
  position: absolute;
  right: 6px;
  bottom: 5px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.cw-attach,
.cw-emoji,
.cw-send {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #536080;
  cursor: pointer;
  place-items: center;
}

.cw-attach svg,
.cw-emoji svg,
.cw-send svg,
.cw-secure svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.cw-attach:disabled {
  opacity: 0.44;
  cursor: not-allowed;
}

.cw-attach[hidden] {
  display: none;
}

.cw-attach:not(:disabled):hover,
.cw-emoji:hover {
  background: #eef0fb;
}

.cw-send {
  width: 40px;
  height: 40px;
  margin-left: 3px;
  background: linear-gradient(135deg, #706dfd 0%, #744df4 56%, #b33be5 100%);
  box-shadow: 0 7px 18px rgba(104, 71, 230, 0.34), 0 0 0 3px rgba(119, 91, 243, 0.06);
  color: #ffffff;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.cw-send svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
  stroke: none;
}

.cw-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 19px rgba(82, 69, 228, 0.36);
}

.cw-send:disabled {
  opacity: 0.5;
  cursor: default;
}

.cw-emoji-panel {
  position: absolute;
  right: 49px;
  bottom: 58px;
  z-index: 5;
  display: grid;
  width: 176px;
  grid-template-columns: repeat(4, 36px);
  gap: 5px;
  padding: 10px;
  border: 1px solid #dce1f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(42, 55, 110, 0.18);
}

.cw-emoji-panel button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  place-items: center;
}

.cw-emoji-panel button:hover {
  background: #f0f2fa;
}

.cw-secure {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
  color: #7e8bac;
  font-size: 11px;
  line-height: 15px;
}

.cw-secure > span:first-child {
  display: grid;
  width: 14px;
  height: 14px;
  color: #68789e;
  place-items: center;
}

.cw-secure svg {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}

.cw-launch:focus-visible,
.cw-close:focus-visible,
.cw-head-action:focus-visible,
.cw-name-save:focus-visible,
.cw-send:focus-visible,
.cw-emoji:focus-visible,
.cw-input:focus-visible {
  outline: 3px solid rgba(74, 99, 245, 0.28);
  outline-offset: 2px;
}

@media (max-width: 380px), (max-height: 650px) {
  .cw-panel {
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .cw-message-content {
    max-width: 86%;
  }
}

@media (max-width: 350px) {
  .cw-head {
    padding-right: 10px;
    padding-left: 12px;
  }

  .cw-title {
    font-size: 16px;
  }

  .cw-messages,
  .cw-compose {
    padding-right: 11px;
    padding-left: 11px;
  }

  .cw-input {
    padding-right: 101px;
  }

  .cw-attach {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cw-launch,
  .cw-send,
  .cw-input-shell {
    transition: none;
  }
}
