.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 92px;
  z-index: 1300;
  font-family: var(--font-ui, "DM Sans", Arial, sans-serif);
  transition: opacity .35s ease, transform .35s ease, visibility .35s ease;
}

.chat-widget__prompt {
  position: absolute;
  right: 62px;
  bottom: 8px;
  max-width: 240px;
  padding: 10px 12px;
  border: 1px solid rgba(43, 45, 50, 0.16);
  border-radius: 10px;
  background: rgba(245, 246, 248, 0.98);
  color: var(--text, #2D313A);
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 14px 34px rgba(30, 33, 40, 0.22);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.chat-widget__prompt::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(43, 45, 50, 0.16);
  border-top: 1px solid rgba(43, 45, 50, 0.16);
  background: rgba(245, 246, 248, 0.98);
  transform: translateY(-50%) rotate(45deg);
}

.chat-widget__prompt.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.chat-widget__launcher {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(43, 45, 50, 0.22);
  border-radius: 14px;
  background: linear-gradient(165deg, #3B404A 0%, #2B2F37 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 0 0 rgba(255, 255, 255, 0.08) inset, 0 12px 34px rgba(43, 45, 50, 0.36);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.chat-widget__launcher:hover {
  transform: translateY(-2px);
  border-color: rgba(43, 45, 50, 0.36);
  box-shadow: 0 2px 0 0 rgba(255, 255, 255, 0.1) inset, 0 16px 40px rgba(43, 45, 50, 0.44);
}

.chat-widget__launcher svg {
  width: 23px;
  height: 23px;
  opacity: 0.95;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.16));
}

.chat-widget__panel {
  position: absolute;
  right: 0;
  bottom: 66px;
  width: min(380px, calc(100vw - 24px));
  height: clamp(440px, 68vh, 560px);
  border: 1px solid rgba(43, 45, 50, 0.18);
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(241, 243, 247, 0.98) 0%, rgba(232, 235, 240, 0.97) 100%);
  box-shadow: 0 24px 56px rgba(30, 33, 40, 0.32);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.chat-widget__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(110, 115, 125, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 115, 125, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.55;
}

.chat-widget__panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-widget__head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(165deg, #454B57 0%, #343840 100%);
  color: #fff;
}

.chat-widget__title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.chat-widget__close {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.chat-widget__close:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.44);
}

.chat-widget__messages {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
}

.chat-widget__msg {
  max-width: 90%;
  padding: 9px 11px;
  border: 1px solid rgba(43, 45, 50, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text, #2D313A);
  font-family: var(--font-body, "Lora", Georgia, serif);
  font-size: 15px;
  line-height: 1.45;
  box-shadow: 0 2px 10px rgba(43, 45, 50, 0.06);
}

.chat-widget__msg--me {
  align-self: flex-end;
  background: #343840;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  font-family: var(--font-ui, "DM Sans", Arial, sans-serif);
  font-size: 14px;
}

.chat-widget__msg--system {
  align-self: center;
  max-width: 96%;
  border-radius: 9px;
  background: rgba(43, 45, 50, 0.08);
  color: var(--muted, #6B6F76);
  border-color: rgba(43, 45, 50, 0.12);
  font-family: var(--font-ui, "DM Sans", Arial, sans-serif);
  font-size: 13px;
  text-align: center;
}

.chat-widget__file-name {
  position: relative;
  z-index: 1;
  margin: 0 14px 8px;
  padding: 7px 10px;
  border: 1px dashed rgba(43, 45, 50, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  color: var(--muted, #6B6F76);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-widget__bar {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 42px 1fr 92px;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(43, 45, 50, 0.15);
  background: rgba(246, 247, 249, 0.85);
}

.chat-widget__attach,
.chat-widget__send {
  min-height: 40px;
  border: 1px solid rgba(43, 45, 50, 0.2);
  border-radius: 8px;
  background: linear-gradient(165deg, #3F444E 0%, #32363E 100%);
  color: #fff;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-widget__attach:hover,
.chat-widget__send:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 18px rgba(43, 45, 50, 0.22);
}

.chat-widget__attach:disabled,
.chat-widget__send:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.chat-widget__attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.chat-widget__attach svg {
  width: 16px;
  height: 16px;
}

.chat-widget__send {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.chat-widget__input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(43, 45, 50, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text, #2D313A);
  padding: 0 11px;
  font-family: var(--font-ui, "DM Sans", Arial, sans-serif);
  font-size: 14px;
  line-height: 1.3;
  outline: none;
}

.chat-widget__input::placeholder {
  color: #81868F;
}

.chat-widget__input:focus {
  border-color: rgba(52, 56, 64, 0.44);
  box-shadow: 0 0 0 3px rgba(52, 56, 64, 0.1);
}

@media (max-width: 768px) {
  .chat-widget {
    right: 12px;
    bottom: 90px;
  }

  .chat-widget__launcher {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }

  .chat-widget__panel {
    bottom: 58px;
    width: min(380px, calc(100vw - 16px));
    height: min(72vh, 500px);
  }

  .chat-widget__prompt {
    right: 54px;
    max-width: 185px;
  }

  .chat-widget__bar {
    grid-template-columns: 40px 1fr 84px;
    gap: 7px;
    padding: 9px 10px 10px;
  }
}
