.jarvis-webchat-root {
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: calc(100vw - 40px);
  position: fixed;
  right: 20px;
  z-index: 1000;
}

.jarvis-webchat-panel {
  background: #101116;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.38);
  color: #f7f3ef;
  display: none;
  flex-direction: column;
  max-height: calc(100vh - 96px);
  overflow: hidden;
  width: min(460px, calc(100vw - 40px));
}

.jarvis-webchat-root[data-open="true"] .jarvis-webchat-panel {
  display: flex;
}

.jarvis-webchat-head {
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  padding: 16px 18px;
  flex-shrink: 0;
}

.jarvis-webchat-kicker {
  color: #aeb4c1;
  font-size: 11px;
  letter-spacing: 0.16em;
  margin: 0;
  text-transform: uppercase;
}

.jarvis-webchat-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 4px 0 0;
}

.jarvis-webchat-close {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #d8d4cd;
  cursor: pointer;
  display: flex;
  font: inherit;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.jarvis-webchat-controls {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  padding: 12px 16px 10px;
}

.jarvis-webchat-control-label {
  color: #aeb4c1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.jarvis-webchat-style-label {
  margin-top: 12px;
}

.jarvis-webchat-tabs,
.jarvis-webchat-style-buttons {
  display: grid;
  gap: 6px;
}

.jarvis-webchat-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.jarvis-webchat-style-buttons {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.jarvis-webchat-tabs button,
.jarvis-webchat-style-buttons button,
.jarvis-webchat-quick-button {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #d7dbe5;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  line-height: 1.15;
  min-height: 48px;
  padding: 7px 9px;
  text-align: center;
}

.jarvis-webchat-button-main {
  color: inherit;
  display: block;
  font-size: 12px;
}

.jarvis-webchat-button-help {
  color: rgba(215, 219, 229, 0.68);
  display: block;
  font-size: 10px;
  font-weight: 600;
}

.jarvis-webchat-tabs button[data-active="true"],
.jarvis-webchat-style-buttons button[data-active="true"] {
  background: #2c6df5;
  border-color: #2c6df5;
  color: #fff;
}

.jarvis-webchat-tabs button[data-active="true"] .jarvis-webchat-button-help,
.jarvis-webchat-style-buttons button[data-active="true"] .jarvis-webchat-button-help {
  color: rgba(255, 255, 255, 0.76);
}

.jarvis-webchat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.jarvis-webchat-quick-button {
  color: #cdd5e5;
  font-weight: 600;
  min-height: 30px;
  padding: 7px 9px;
  text-align: left;
}

.jarvis-webchat-messages {
  flex: 1;
  max-height: 328px;
  min-height: 120px;
  overflow-y: auto;
  padding: 16px;
}

.jarvis-webchat-message {
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  margin-top: 10px;
  padding: 12px 14px;
  white-space: pre-wrap;
}

.jarvis-webchat-message:first-child {
  margin-top: 0;
}

.jarvis-webchat-message.assistant {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-right: 42px;
}

.jarvis-webchat-message.assistant.pending {
  color: #aeb4c1;
  font-style: italic;
}

.jarvis-webchat-message.user {
  background: #2c6df5;
  color: #fff;
  margin-left: 42px;
}

.jarvis-webchat-form {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  padding: 12px;
}

.jarvis-webchat-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #fff;
  flex: 1;
  font: inherit;
  font-size: 14px;
  min-height: 44px;
  min-width: 0;
  outline: none;
  padding: 11px 14px;
}

.jarvis-webchat-input:focus {
  border-color: #6f95ff;
}

.jarvis-webchat-send,
.jarvis-webchat-toggle {
  background: #2c6df5;
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  min-height: 44px;
  padding: 12px 16px;
}

.jarvis-webchat-form[data-loading="true"] .jarvis-webchat-send::after {
  content: "...";
}

.jarvis-webchat-form[data-loading="true"] .jarvis-webchat-send {
  color: transparent;
  position: relative;
}

.jarvis-webchat-form[data-loading="true"] .jarvis-webchat-send::after {
  color: #fff;
  inset: 0;
  position: absolute;
  display: grid;
  place-items: center;
}

.jarvis-webchat-send:disabled {
  cursor: wait;
  opacity: 0.72;
}

.jarvis-webchat-toggle {
  align-self: flex-end;
  box-shadow: 0 16px 50px rgba(44, 109, 245, 0.32);
  padding: 13px 20px;
}

@media (max-width: 560px) {
  .jarvis-webchat-root {
    bottom: 14px;
    right: 14px;
  }

  .jarvis-webchat-panel {
    max-height: calc(100vh - 88px);
  }

  .jarvis-webchat-tabs {
    grid-template-columns: 1fr;
  }

  .jarvis-webchat-style-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .jarvis-webchat-form {
    flex-direction: column;
  }

  .jarvis-webchat-message.assistant {
    margin-right: 18px;
  }

  .jarvis-webchat-message.user {
    margin-left: 18px;
  }
}
