.chat-fab {
  position: fixed;
  top: 16px;
  right: 260px;
  z-index: 9999;

  height: 40px;
  padding: 0 12px;

  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #ffffff;
  color: #111;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
}

.chat-fab i {
  width: 18px;
  height: 18px;
}

.chat-fab-text {
  font-weight: 600;
  font-size: 13px;
}

.chat-fab.hidden {
  display: none;
}

.chat-widget {
  position: fixed;
  top: 70px;
  right: 18px;
  z-index: 9999;

  width: min(340px, calc(100vw - 36px));
  height: min(420px, calc(100vh - 24px));

  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);

  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.chat-widget.hidden {
  display: none;
}

.chat-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;

  padding: 10px 12px;
  background: #f0f0f0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);

  cursor: move;
  user-select: none;
  touch-action: none;
}

.chat-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);

  font-weight: 700;
  font-size: 18px;
  color: rgb(0, 0, 0);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);

  max-width: calc(100% - 70px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-close {
  border: none;
  background: transparent;
  color: rgba(0, 0, 0, 0.65);
  cursor: pointer;
  font-size: 18px;
}

.chat-messages {
  padding: 12px;
  overflow: auto;
  background: #fff;
}

.chat-msg {
  padding: 10px 10px;
  border-radius: 12px;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.chat-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.chat-user {
  font-weight: 700;
  font-size: 12px;
  color: #111;
}

.chat-time {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}

.chat-text {
  font-size: 13px;
  color: rgba(0, 0, 0, 0.88);
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-del {
  border: none;
  background: transparent;
  color: #c81e1e;
  cursor: pointer;
}

.chat-del:hover {
  color: #a81818;
}

.chat-del svg {
  stroke: currentColor;
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;

  padding: 10px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
}

.chat-input textarea {
  width: 100%;
  resize: none;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(0, 0, 0, 0.03);
  color: #111;

  padding: 10px 10px;
  outline: none;
  font-family: inherit;
  font-size: 13px;
}

.chat-input button {
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(0, 0, 0, 0.06);
  color: #111;

  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
}

.chat-loading {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
  padding: 8px 0;
  text-align: center;
}
