#harvey-ai-chat-root {
  position: fixed !important;
  right: 18px !important;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px)) !important;
  z-index: 2147483000 !important;
  font-family: Inter, Arial, sans-serif !important;
  pointer-events: none !important;
}

#harvey-ai-chat-root * {
  box-sizing: border-box;
}

#harvey-ai-chat-root .harvey-ai-widget,
#harvey-ai-chat-root .harvey-ai-widget * {
  pointer-events: auto;
}

.harvey-ai-widget {
  position: relative;
}

.harvey-ai-launch {
  width: 72px;
  height: 72px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 26px;
  font-weight: 900;
  color: #06111f;
  background: linear-gradient(135deg, #6ee7ff 0%, #7aa2ff 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.harvey-ai-launch:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.38);
}

.harvey-ai-launch:active {
  transform: translateY(0);
}

.harvey-ai-panel {
  position: absolute;
  right: 0;
  bottom: 88px;
  width: min(760px, calc(100vw - 32px));
  max-width: 760px;
  height: min(82vh, 960px);
  min-height: 640px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at top left, rgba(110, 231, 255, 0.13), transparent 30%),
    radial-gradient(circle at bottom right, rgba(122, 162, 255, 0.10), transparent 30%),
    #081224;
  color: #ffffff;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.harvey-ai-panel.open {
  display: flex;
}

.harvey-ai-panel.expanded {
  position: fixed;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  left: 14px;
  width: auto;
  max-width: none;
  height: auto;
  min-height: 0;
  border-radius: 26px;
  z-index: 2147483001;
}

.harvey-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 18, 36, 0.92);
  flex-shrink: 0;
}

.harvey-ai-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.harvey-ai-badge {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
  color: #06111f;
  background: linear-gradient(135deg, #6ee7ff 0%, #7aa2ff 100%);
  flex-shrink: 0;
}

.harvey-ai-title-wrap {
  min-width: 0;
}

.harvey-ai-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.harvey-ai-subtitle {
  margin-top: 4px;
  font-size: 14px;
  color: rgba(220, 230, 255, 0.72);
  line-height: 1.4;
}

.harvey-ai-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.harvey-ai-icon-btn {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  cursor: pointer;
  font-size: 21px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.18s ease, transform 0.18s ease;
}

.harvey-ai-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.harvey-ai-icon-btn:active {
  transform: translateY(0);
}

.harvey-ai-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.harvey-ai-body::-webkit-scrollbar {
  width: 8px;
}

.harvey-ai-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.harvey-ai-message {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.harvey-ai-message.user {
  align-items: flex-end;
}

.harvey-ai-message.assistant {
  align-items: flex-start;
}

.harvey-ai-bubble {
  max-width: 90%;
  padding: 18px 20px;
  border-radius: 24px;
  font-size: 17px;
  line-height: 1.68;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.harvey-ai-message.assistant .harvey-ai-bubble {
  background: rgba(255, 255, 255, 0.08);
  color: #f4f7ff;
  border-bottom-left-radius: 8px;
}

.harvey-ai-message.user .harvey-ai-bubble {
  background: linear-gradient(135deg, #79f0b7 0%, #78f0e9 100%);
  color: #07131f;
  border-bottom-right-radius: 8px;
  font-weight: 600;
}

.harvey-ai-meta {
  font-size: 12px;
  color: rgba(220, 230, 255, 0.65);
  padding: 0 4px;
}

.harvey-ai-system-line {
  font-size: 13px;
  color: rgba(220, 230, 255, 0.68);
  padding: 6px 2px 0;
  text-align: center;
  line-height: 1.6;
}

.harvey-ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.harvey-ai-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #b9c7ff;
  animation: harveyTyping 1.1s infinite ease-in-out;
}

.harvey-ai-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.harvey-ai-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes harveyTyping {
  0%, 80%, 100% {
    transform: scale(0.7);
    opacity: 0.6;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.harvey-ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.harvey-ai-suggestion {
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
  color: #eaf0ff;
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.harvey-ai-suggestion:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(110, 231, 255, 0.3);
  transform: translateY(-1px);
}

.harvey-ai-footer {
  padding: 18px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 18, 36, 0.95);
  flex-shrink: 0;
}

.harvey-ai-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.harvey-ai-input {
  min-height: 74px;
  max-height: 180px;
  resize: none;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(110, 231, 255, 0.18);
  background: rgba(7, 16, 34, 0.95);
  color: #ffffff;
  font-size: 16px;
  line-height: 1.55;
  outline: none;
  width: 100%;
}

.harvey-ai-input:focus {
  border-color: rgba(110, 231, 255, 0.46);
  box-shadow: 0 0 0 3px rgba(110, 231, 255, 0.08);
}

.harvey-ai-input::placeholder {
  color: rgba(220, 230, 255, 0.48);
}

.harvey-ai-send {
  width: 92px;
  height: 74px;
  border: none;
  border-radius: 22px;
  cursor: pointer;
  font-size: 28px;
  font-weight: 800;
  color: #07131f;
  background: linear-gradient(135deg, #79f0b7 0%, #78f0e9 100%);
  box-shadow: 0 12px 28px rgba(121, 240, 183, 0.25);
  -webkit-appearance: none;
  appearance: none;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.harvey-ai-send:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.harvey-ai-send:active {
  transform: translateY(0);
}

.harvey-ai-send:disabled,
.harvey-ai-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.harvey-ai-footnote {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(220, 230, 255, 0.72);
}

@media (max-width: 1100px) {
  .harvey-ai-panel {
    width: min(680px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
    height: min(82vh, 900px);
    min-height: 620px;
  }
}

@media (max-width: 900px) {
  .harvey-ai-panel {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    height: min(82vh, 840px);
    min-height: 600px;
  }

  .harvey-ai-bubble {
    max-width: 94%;
  }
}

@media (max-width: 640px) {
  #harvey-ai-chat-root {
    right: 12px !important;
    left: auto !important;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .harvey-ai-launch {
    width: 60px;
    height: 60px;
    font-size: 22px;
  }

  .harvey-ai-panel {
    right: 0;
    bottom: 74px;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    height: min(80vh, 760px);
    min-height: 540px;
    border-radius: 24px;
  }

  .harvey-ai-panel.expanded {
    top: max(10px, env(safe-area-inset-top, 0px));
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    left: 10px;
    border-radius: 20px;
  }

  .harvey-ai-header {
    padding: 16px;
    gap: 10px;
  }

  .harvey-ai-header-left {
    gap: 12px;
  }

  .harvey-ai-badge {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    font-size: 20px;
  }

  .harvey-ai-title {
    font-size: 18px;
  }

  .harvey-ai-subtitle {
    font-size: 13px;
  }

  .harvey-ai-actions {
    gap: 8px;
  }

  .harvey-ai-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 18px;
  }

  .harvey-ai-body {
    padding: 16px;
    gap: 14px;
  }

  .harvey-ai-bubble {
    max-width: 96%;
    font-size: 15px;
    line-height: 1.6;
    padding: 16px 18px;
    border-radius: 20px;
  }

  .harvey-ai-suggestions {
    padding: 14px 16px;
    gap: 10px;
  }

  .harvey-ai-suggestion {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
  }

  .harvey-ai-footer {
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .harvey-ai-form {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .harvey-ai-input {
    min-height: 66px;
    max-height: 150px;
    font-size: 15px;
    padding: 16px 18px;
    border-radius: 20px;
  }

  .harvey-ai-send {
    width: 74px;
    height: 66px;
    border-radius: 20px;
    font-size: 24px;
  }
}

@media (max-width: 420px) {
  #harvey-ai-chat-root {
    right: 10px !important;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .harvey-ai-panel {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    min-height: 500px;
    bottom: 70px;
  }

  .harvey-ai-header {
    padding: 14px;
  }

  .harvey-ai-body {
    padding: 14px;
  }

  .harvey-ai-suggestions {
    padding: 12px 14px;
  }

  .harvey-ai-footer {
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .harvey-ai-title {
    font-size: 17px;
  }

  .harvey-ai-subtitle {
    font-size: 12px;
  }

  .harvey-ai-bubble {
    font-size: 14px;
    padding: 14px 16px;
  }

  .harvey-ai-send {
    width: 70px;
  }
}
