.zyvra-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  text-transform: none;
  letter-spacing: normal;
}

.zyvra-chat * {
  box-sizing: border-box;
}

.zyvra-chat__button {
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  color: #fff;
  background: #3730a3;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(20, 20, 26, 0.10), 0 1px 2px rgba(20, 20, 26, 0.06);
  transition: background-color 180ms cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 180ms cubic-bezier(0.2, 0.7, 0.2, 1),
              box-shadow 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.zyvra-chat__button:hover {
  background: #2e2885;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(20, 20, 26, 0.14), 0 0 0 4px rgba(55, 48, 163, 0.08);
}

.zyvra-chat__panel {
  display: none;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 96px));
  border: 1px solid rgba(20, 20, 26, 0.12);
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
  color: #14141a;
  box-shadow: 0 20px 48px rgba(20, 20, 26, 0.14), 0 2px 6px rgba(20, 20, 26, 0.06);
}

.zyvra-chat--open .zyvra-chat__panel {
  display: flex;
  flex-direction: column;
}

.zyvra-chat--open .zyvra-chat__button {
  display: none;
}

.zyvra-chat__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(20, 20, 26, 0.08);
  background: #faf8f4;
}

.zyvra-chat__title {
  margin: 0;
  color: #3730a3;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.zyvra-chat__subtitle {
  margin: 6px 0 0;
  color: #3a3a45;
  font-size: 12px;
  line-height: 1.5;
}

.zyvra-chat__close {
  border: 0;
  min-width: 36px;
  min-height: 36px;
  padding: 4px;
  color: #6b6b78;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 8px;
  transition: background-color 120ms cubic-bezier(0.2, 0.7, 0.2, 1),
              color 120ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.zyvra-chat__close:hover {
  background: rgba(20, 20, 26, 0.05);
  color: #14141a;
}

.zyvra-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #ffffff;
}

.zyvra-chat__message {
  margin: 0 0 12px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: #14141a;
}

.zyvra-chat__message--assistant {
  border: 1px solid rgba(20, 20, 26, 0.08);
  background: #faf8f4;
  color: #14141a;
}

.zyvra-chat__message--user {
  margin-left: 44px;
  background: #eceaff;
  color: #2e2885;
}

.zyvra-chat__message hr {
  border: none;
  border-top: 1px solid rgba(20, 20, 26, 0.08);
  margin: 8px 0;
}

.zyvra-chat__message blockquote {
  margin: 6px 0;
  padding: 6px 10px;
  border-left: 2px solid #3730a3;
  color: #3a3a45;
  font-style: italic;
}

.zyvra-chat__message code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(20, 20, 26, 0.06);
  color: #14141a;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
}

.zyvra-chat__sources {
  margin-top: 8px;
  display: grid;
  gap: 4px;
}

.zyvra-chat__sources a {
  color: #3730a3;
  font-size: 12px;
  text-decoration: none;
}

.zyvra-chat__sources a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.zyvra-chat__form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(20, 20, 26, 0.08);
  background: #faf8f4;
}

.zyvra-chat__notice {
  margin: 0;
  color: #6b6b78;
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.zyvra-chat__input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.zyvra-chat__input {
  flex: 1;
  min-width: 0;
  min-height: 64px;
  max-height: 120px;
  resize: none;
  overflow-y: auto;
  border: 1px solid rgba(20, 20, 26, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  color: #14141a;
  background: #ffffff;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  outline: none;
  transition: border-color 180ms cubic-bezier(0.2, 0.7, 0.2, 1),
              box-shadow 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
  scrollbar-width: none;
}

.zyvra-chat__input::-webkit-scrollbar {
  display: none;
}

.zyvra-chat__input:focus {
  border-color: #3730a3;
  box-shadow: 0 0 0 3px rgba(55, 48, 163, 0.18);
}

.zyvra-chat__input::placeholder {
  color: #9a9aa6;
}

.zyvra-chat__send {
  flex-shrink: 0;
  border: 0;
  border-radius: 10px;
  height: 40px;
  padding: 0 16px;
  color: #fff;
  background: #3730a3;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 180ms cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.zyvra-chat__send:hover:not(:disabled) {
  background: #2e2885;
  transform: translateY(-1px);
}

.zyvra-chat__send:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 560px) {
  .zyvra-chat {
    right: 0;
    bottom: 0;
    left: 0;
  }

  .zyvra-chat__button {
    position: absolute;
    right: 16px;
    bottom: 16px;
  }

  .zyvra-chat__panel {
    width: 100vw;
    height: calc(100dvh - 56px);
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    position: fixed;
    bottom: 0;
    left: 0;
  }
}
