.chat-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  font-family: Montserrat, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.chat-widget__fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 52px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0f0f0f;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.2px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.chat-widget__fab:focus-visible {
  outline: 2px solid #F5B400;
  outline-offset: 3px;
}

.chat-widget__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  border: 2px solid #111;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chat-widget__badge[hidden] {
  display: none !important;
}

.chat-widget__panel {
  position: absolute;
  right: 0;
  bottom: 62px;
  width: min(360px, calc(100vw - 36px));
  height: min(520px, calc(100vh - 120px));
  background: #111;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: none;
}

.chat-widget__panel.is-open {
  display: flex;
  flex-direction: column;
}

.chat-widget__header {
  padding: 14px 14px 12px;
  background: linear-gradient(135deg, rgba(245, 180, 0, 0.18), rgba(245, 180, 0, 0.05));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.chat-widget__header--with-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-right: 10px;
}

.chat-widget__header-titles {
  min-width: 0;
  flex: 1;
}

.chat-widget__header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-widget__header--with-actions .chat-widget__close {
  position: static;
  top: auto;
  right: auto;
}

.chat-widget__header-delete {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 80, 80, 0.45);
  background: rgba(255, 60, 60, 0.15);
  color: #ff9a9a;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.chat-widget__header-delete:hover {
  background: rgba(255, 60, 60, 0.28);
  color: #ffcfcf;
}

.chat-widget__title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

.chat-widget__subtitle {
  margin-top: 2px;
  font-weight: 500;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.chat-widget__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.chat-widget__messages {
  padding: 14px;
  overflow: auto;
  flex: 1;
  background: radial-gradient(1200px 500px at 100% 0%, rgba(245, 180, 0, 0.06), transparent 55%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-widget__bubble {
  max-width: 90%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.35;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
}

.chat-widget__bubble--manager {
  border-top-left-radius: 6px;
}

.chat-widget__bubble--client {
  margin-left: auto;
  border-top-right-radius: 6px;
  background: rgba(245, 180, 0, 0.18);
  border-color: rgba(245, 180, 0, 0.30);
}

.chat-widget__meta {
  margin-top: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.chat-widget__toolbar {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

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

.chat-widget__conversation-select {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 12px;
  padding: 0 10px;
}

.chat-widget__delete-chat {
  flex-shrink: 0;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 80, 80, 0.45);
  background: rgba(255, 60, 60, 0.12);
  color: #ff8a8a;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.chat-widget__delete-chat:hover {
  background: rgba(255, 60, 60, 0.22);
  color: #ffb3b3;
}

.chat-widget__empty {
  margin: auto;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.68);
}

.chat-widget__form {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}

.chat-widget__input {
  flex: 1;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 13px;
  outline: none;
}

.chat-widget__input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.chat-widget__send {
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: #F5B400;
  color: #121212;
  font-weight: 700;
  opacity: 0.7;
}

.chat-widget__send[disabled] {
  cursor: not-allowed;
}

@media (max-width: 420px) {
  .chat-widget {
    right: 14px;
    bottom: 14px;
  }

  .chat-widget__fab {
    height: 48px;
    padding: 0 16px;
  }
}
