.oulu-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 160;
  font-family: var(--body, "Manrope", "Segoe UI", sans-serif);
  color: var(--ink, #211a18);
  transition: opacity 180ms ease, transform 180ms ease;
}

body.is-locked .oulu-chat:not(.is-open) {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

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

.oulu-chat__launcher {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 11px;
  min-width: 196px;
  min-height: 62px;
  padding: 8px 15px 8px 9px;
  color: #fff;
  background:
    radial-gradient(circle at 18% 5%, rgba(255, 255, 255, 0.2), transparent 32%),
    linear-gradient(135deg, #971c45, #65102b 68%, #40101f);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 19px;
  box-shadow: 0 18px 50px rgba(65, 16, 34, 0.28), 0 4px 16px rgba(33, 26, 24, 0.15);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.oulu-chat__launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 60px rgba(65, 16, 34, 0.34), 0 5px 18px rgba(33, 26, 24, 0.16);
}

.oulu-chat.is-open .oulu-chat__launcher {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.oulu-chat__launcher-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #64112b;
  background: linear-gradient(145deg, #fffaf2, #f0dfc7);
  border-radius: 13px;
  box-shadow: inset 0 0 0 1px rgba(99, 16, 41, 0.1);
}

.oulu-chat__launcher-mark svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.oulu-chat__launcher-copy {
  display: grid;
  gap: 2px;
  text-align: left;
}

.oulu-chat__launcher-copy small {
  color: rgba(255, 255, 255, 0.66);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
}

.oulu-chat__launcher-copy strong {
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.01em;
}

.oulu-chat__pulse,
.oulu-chat__status i {
  width: 8px;
  height: 8px;
  background: #6fe2a4;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(111, 226, 164, 0.42);
  animation: oulu-chat-pulse 2.2s infinite;
}

@keyframes oulu-chat-pulse {
  0%, 60%, 100% { box-shadow: 0 0 0 0 rgba(111, 226, 164, 0); }
  25% { box-shadow: 0 0 0 6px rgba(111, 226, 164, 0.13); }
}

.oulu-chat__badge {
  position: absolute;
  top: -7px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  color: #fff;
  background: #d2334f;
  border: 2px solid #fff;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.oulu-chat__panel {
  width: min(410px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 32px));
  overflow: hidden;
  background: rgba(255, 253, 249, 0.985);
  border: 1px solid rgba(63, 35, 37, 0.14);
  border-radius: 27px;
  box-shadow: 0 30px 90px rgba(50, 25, 33, 0.28), 0 5px 22px rgba(33, 26, 24, 0.13);
  transform-origin: 100% 100%;
  animation: oulu-chat-in 210ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes oulu-chat-in {
  from { opacity: 0; transform: translateY(14px) scale(0.965); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.oulu-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 15px;
  color: #fff;
  background:
    radial-gradient(circle at 0 0, rgba(242, 220, 174, 0.28), transparent 36%),
    linear-gradient(128deg, #72112f 0%, #481321 100%);
}

.oulu-chat__identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.oulu-chat__identity img {
  width: 43px;
  height: 43px;
  padding: 7px;
  background: #fffaf2;
  border-radius: 13px;
  box-shadow: 0 5px 14px rgba(16, 4, 8, 0.18);
}

.oulu-chat__identity h2 {
  margin: 0 0 3px;
  color: #fff;
  font-family: var(--body, sans-serif);
  font-size: 15px;
  font-weight: 770;
  letter-spacing: -0.01em;
}

.oulu-chat__identity p {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 9px;
  line-height: 1.35;
}

.oulu-chat__close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0 0 2px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.oulu-chat__status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  color: #376151;
  background: #eaf5ed;
  border-bottom: 1px solid rgba(31, 73, 59, 0.09);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.oulu-chat__status i {
  width: 7px;
  height: 7px;
  border: 0;
  background: #38ad72;
}

.oulu-chat__content {
  max-height: calc(min(720px, 100vh - 32px) - 113px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 16, 41, 0.25) transparent;
}

.oulu-chat__prechat,
.oulu-chat__conversation {
  padding: 18px;
}

.oulu-chat__intro {
  margin: 0 0 15px;
  color: #625750;
  font-size: 11px;
  line-height: 1.6;
}

.oulu-chat__lead-form,
.oulu-chat__message-form {
  display: grid;
  gap: 11px;
}

.oulu-chat__field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.oulu-chat label {
  display: grid;
  gap: 6px;
}

.oulu-chat label > span {
  color: #554943;
  font-size: 9px;
  font-weight: 720;
}

.oulu-chat input,
.oulu-chat textarea {
  width: 100%;
  color: #2c2421;
  background: #fff;
  border: 1px solid rgba(33, 26, 24, 0.15);
  border-radius: 11px;
  outline: none;
  font: 500 11px/1.5 var(--body, sans-serif);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.oulu-chat input {
  min-height: 40px;
  padding: 9px 11px;
}

.oulu-chat textarea {
  min-height: 74px;
  padding: 10px 11px;
  resize: vertical;
}

.oulu-chat input:focus,
.oulu-chat textarea:focus {
  background: #fffefd;
  border-color: rgba(139, 21, 56, 0.55);
  box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.08);
}

.oulu-chat__consent {
  grid-template-columns: 16px 1fr;
  align-items: start;
  gap: 8px !important;
  color: #6e635d;
  font-size: 9px;
  line-height: 1.5;
}

.oulu-chat__consent input {
  width: 15px;
  min-height: 15px;
  height: 15px;
  margin-top: 1px;
  accent-color: #8b1538;
}

.oulu-chat__consent span {
  color: inherit !important;
  font-weight: 520 !important;
}

.oulu-chat__consent a {
  color: #7d1737;
  font-weight: 720;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.oulu-chat__honeypot {
  position: absolute !important;
  left: -99999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.oulu-chat__primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 45px;
  padding: 0 15px;
  color: #fff;
  background: linear-gradient(130deg, #8b1538, #631029);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(99, 16, 41, 0.18);
  font: 760 10px/1 var(--body, sans-serif);
  letter-spacing: 0.02em;
  cursor: pointer;
}

.oulu-chat button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.oulu-chat__form-status,
.oulu-chat__delivery {
  min-height: 15px;
  margin: 0;
  color: #456d5d;
  font-size: 9px;
  line-height: 1.5;
}

.oulu-chat__form-status.is-error,
.oulu-chat__delivery.is-error {
  color: #a12c3c;
}

.oulu-chat__fallback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 13px;
  padding-top: 12px;
  color: #625750;
  border-top: 1px solid rgba(33, 26, 24, 0.09);
  font-size: 9px;
  font-weight: 720;
  text-decoration: none;
}

.oulu-chat__conversation-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
  padding: 8px 10px;
  color: #665b55;
  background: #f5eee4;
  border: 1px solid rgba(112, 78, 55, 0.08);
  border-radius: 10px;
  font-size: 8px;
}

.oulu-chat__conversation-meta strong {
  color: #781735;
  letter-spacing: 0.08em;
}

.oulu-chat__conversation-meta small {
  color: #527164;
  font-size: 8px;
}

.oulu-chat__messages {
  display: flex;
  flex-direction: column;
  gap: 11px;
  height: 278px;
  overflow-y: auto;
  padding: 3px 3px 7px;
  scrollbar-width: thin;
}

.oulu-chat__message {
  display: grid;
  max-width: 84%;
}

.oulu-chat__message.is-visitor {
  align-self: flex-end;
  justify-items: end;
}

.oulu-chat__message.is-agent,
.oulu-chat__message.is-system {
  align-self: flex-start;
}

.oulu-chat__message > span {
  margin: 0 5px 4px;
  color: #8b7e77;
  font-size: 8px;
  font-weight: 700;
}

.oulu-chat__message p {
  margin: 0;
  padding: 10px 12px;
  color: #342c29;
  background: #f0e9df;
  border-radius: 5px 15px 15px 15px;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.oulu-chat__message.is-visitor p {
  color: #fff;
  background: linear-gradient(135deg, #891637, #67112c);
  border-radius: 15px 5px 15px 15px;
}

.oulu-chat__message.is-system p {
  color: #5e554f;
  background: #f7f2eb;
  border: 1px dashed rgba(33, 26, 24, 0.13);
}

.oulu-chat__message time {
  margin: 4px 5px 0;
  color: #aa9e97;
  font-size: 7px;
}

.oulu-chat__message-form {
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  background: #f5efe7;
  border: 1px solid rgba(33, 26, 24, 0.09);
  border-radius: 14px;
}

.oulu-chat__message-form textarea {
  min-height: 44px;
  max-height: 110px;
  padding: 8px 9px;
  background: transparent;
  border: 0;
  box-shadow: none;
  resize: none;
}

.oulu-chat__message-form textarea:focus {
  background: #fff;
  box-shadow: none;
}

.oulu-chat__message-form button {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  padding: 0;
  color: #fff;
  background: #781735;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
}

.oulu-chat__message-form button span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.oulu-chat__message-form svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.oulu-chat__privacy {
  margin: 8px 0 0;
  color: #958983;
  font-size: 7.5px;
  line-height: 1.5;
  text-align: center;
}

.oulu-chat__closed-actions {
  margin-top: 8px;
}

.oulu-chat__closed-actions button {
  width: 100%;
  min-height: 39px;
  color: #761634;
  background: #fff;
  border: 1px solid rgba(118, 22, 52, 0.22);
  border-radius: 11px;
  font: 730 9px/1 var(--body, sans-serif);
  cursor: pointer;
}

@media (max-width: 640px) {
  .oulu-chat {
    right: 10px;
    bottom: 10px;
  }

  .oulu-chat__launcher {
    grid-template-columns: 1fr;
    min-width: 52px;
    width: 52px;
    min-height: 52px;
    height: 52px;
    padding: 5px;
    border-radius: 50%;
  }

  .oulu-chat__launcher-mark {
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }

  .oulu-chat__launcher-copy,
  .oulu-chat__pulse {
    display: none;
  }

  .oulu-chat__panel {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 23px;
  }

  .oulu-chat__content {
    max-height: calc(100dvh - 133px);
  }

  .oulu-chat__field-pair {
    grid-template-columns: 1fr;
  }

  .oulu-chat__messages {
    height: min(300px, 34dvh);
  }
}

@media (prefers-reduced-motion: reduce) {
  .oulu-chat__panel,
  .oulu-chat__pulse,
  .oulu-chat__status i {
    animation: none;
  }
}
