.jessica-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  display: grid;
  justify-items: end;
  gap: 10px;
  color: #1f2330;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  pointer-events: none;
}

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

.jessica-chat-panel {
  width: min(410px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 112px));
  display: none;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(23, 26, 29, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 60px rgba(20, 18, 15, 0.18);
  pointer-events: auto;
}

.jessica-chat.is-open .jessica-chat-panel {
  display: grid;
}

.jessica-chat-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(23, 26, 29, 0.08);
}

.jessica-chat-header strong,
.jessica-chat-header span {
  display: block;
}

.jessica-chat-header strong {
  font-size: 0.96rem;
  line-height: 1.2;
}

.jessica-chat-header span {
  margin-top: 2px;
  color: #5f6a7c;
  font-size: 0.8rem;
  line-height: 1.35;
}

.jessica-chat-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.jessica-chat-close,
.jessica-chat-text-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(23, 26, 29, 0.14);
  border-radius: 999px;
  background: #fff;
  color: #5f6a7c;
}

.jessica-chat-close {
  font-size: 1.35rem;
  line-height: 1;
}

.jessica-chat-text-toggle {
  width: 38px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
}

.jessica-chat-text-toggle[aria-pressed="true"] {
  border-color: rgba(72, 100, 119, 0.34);
  background: #eef4f6;
  color: #263947;
}

.jessica-chat-log {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding: 14px;
}

.jessica-chat-row {
  display: flex;
  gap: 10px;
}

.jessica-chat-row.user {
  justify-content: flex-end;
}

.jessica-chat-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #f4e8dc url("/assets/jessica-avatar.svg") center / cover no-repeat;
  border: 1px solid rgba(38, 57, 71, 0.14);
  box-shadow: 0 2px 6px rgba(20, 18, 15, 0.08);
}

.jessica-chat-bubble {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 14px;
  background: #f5f2ee;
  color: #334155;
  font-size: 0.92rem;
  line-height: 1.5;
}

.jessica-chat-row.user .jessica-chat-bubble {
  background: #486477;
  color: #fff;
}

.jessica-chat-form {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(23, 26, 29, 0.08);
}

.jessica-chat-input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  background: #fff;
  color: #1f2330;
  font: inherit;
  font-size: 0.95rem;
}

.jessica-chat-input:focus {
  outline: 3px solid rgba(72, 100, 119, 0.14);
  border-color: #486477;
}

.jessica-chat-send,
.jessica-chat-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: #486477;
  color: #fff;
  cursor: pointer;
}

.jessica-chat-send {
  width: 46px;
  height: 46px;
  border-radius: 7px;
}

.jessica-chat-send:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.jessica-chat-button {
  gap: 9px;
  min-width: 62px;
  height: 58px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(31, 35, 48, 0.2);
  font-weight: 800;
  pointer-events: auto;
}

.jessica-chat.is-open .jessica-chat-button {
  width: 54px;
  min-width: 54px;
  height: 54px;
  padding: 0;
  background: #263947;
}

.jessica-chat.is-open .jessica-chat-button span {
  display: none;
}

.jessica-chat-button svg,
.jessica-chat-send svg {
  display: block;
}

.jessica-chat.is-large-text .jessica-chat-header strong {
  font-size: 1.06rem;
}

.jessica-chat.is-large-text .jessica-chat-header span {
  font-size: 0.88rem;
}

.jessica-chat.is-large-text .jessica-chat-bubble,
.jessica-chat.is-large-text .jessica-chat-input {
  font-size: 1.06rem;
  line-height: 1.58;
}

@media (max-width: 720px) {
  .jessica-chat {
    right: 12px;
    bottom: 82px;
  }

  .jessica-chat-panel {
    width: calc(100vw - 24px);
    height: min(560px, calc(100vh - 156px));
  }

  .jessica-chat-button {
    width: 54px;
    min-width: 54px;
    height: 54px;
    padding: 0;
  }

  .jessica-chat-button span {
    display: none;
  }
}
