:root {
  --harvey-bg: #0f292d;
  --harvey-bg-deep: #0a1e22;
  --harvey-panel: #17373b;
  --harvey-accent: #d7a33d;
  --harvey-teal: #08a7aa;
  --harvey-text: #ffffff;
  --harvey-muted: rgba(255, 255, 255, 0.76);
}

body.harvey-overlay-open {
  overflow: hidden;
}

.harvey-launcher {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 14px));
  width: 78px;
  height: 78px;
  padding: 4px;
  border: 3px solid var(--harvey-teal);
  border-radius: 50%;
  background: rgba(11, 37, 41, 0.94);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  overflow: visible;
  z-index: 9997;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.harvey-launcher:hover,
.harvey-launcher:focus-visible {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.42);
  outline: none;
}

.harvey-launcher img {
  display: block;
  position: absolute;
  top: -34%;
  left: 47%;
  width: 190%;
  height: auto;
  max-width: none;
  clip-path: inset(0 0 37% 0);
  transform: translateX(-50%);
}

.harvey-greeting {
  position: fixed;
  right: max(108px, calc(env(safe-area-inset-right) + 108px));
  bottom: max(31px, calc(env(safe-area-inset-bottom) + 23px));
  width: max-content;
  max-width: min(240px, calc(100vw - 128px));
  padding: 10px 13px;
  border: 1px solid rgba(8, 167, 170, 0.42);
  border-radius: 15px;
  color: #123237;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(7px) scale(0.98);
  transition: opacity 300ms ease, transform 300ms ease;
  z-index: 9998;
}

.harvey-greeting::after {
  content: '';
  position: absolute;
  right: -8px;
  bottom: 17px;
  width: 16px;
  height: 16px;
  border-top: 1px solid rgba(8, 167, 170, 0.42);
  border-right: 1px solid rgba(8, 167, 170, 0.42);
  background: #ffffff;
  transform: rotate(45deg);
}

.harvey-greeting.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.harvey-greeting.is-hiding {
  opacity: 0;
  pointer-events: none;
  transform: translateY(7px) scale(0.98);
}

.harvey-greeting:focus-visible {
  outline: 3px solid rgba(215, 163, 61, 0.7);
  outline-offset: 3px;
}

.harvey-overlay[hidden] {
  display: none;
}

.harvey-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: var(--harvey-text);
  background: rgba(3, 16, 19, 0.68);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  font-family: inherit;
}

.harvey-shell {
  width: min(90vw, 440px);
  height: min(70vh, 680px);
  max-height: calc(100vh - 32px);
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  background:
    radial-gradient(circle at 20% 0%, rgba(8, 167, 170, 0.16), transparent 38%),
    linear-gradient(160deg, var(--harvey-bg) 0%, var(--harvey-bg-deep) 100%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

.harvey-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.harvey-close:focus-visible,
.harvey-suggestion:focus-visible,
.harvey-send:focus-visible,
.harvey-mic:focus-visible {
  outline: 3px solid rgba(215, 163, 61, 0.65);
  outline-offset: 2px;
}

.harvey-main {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.harvey-welcome {
  position: relative;
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 12px;
  align-items: center;
  margin: 0 0 14px;
  padding: 12px 58px 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
}

.harvey-welcome img {
  width: 108px;
  height: 116px;
  object-fit: contain;
}

.harvey-welcome h2 {
  margin: 0 0 6px;
  color: #fff;
  font-size: 1.35rem;
  line-height: 1.12;
}

.harvey-welcome p {
  margin: 0;
  color: var(--harvey-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.harvey-context-label {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.harvey-suggestions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.harvey-suggestion {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 13px;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.harvey-suggestion:hover {
  background: rgba(255, 255, 255, 0.12);
}

.harvey-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.harvey-message {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 15px;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.harvey-message--assistant {
  align-self: flex-start;
  color: #fff;
  background: var(--harvey-panel);
  border-bottom-left-radius: 5px;
}

.harvey-message--user {
  align-self: flex-end;
  color: #062326;
  background: #e5f6f6;
  border-bottom-right-radius: 5px;
}

.harvey-composer {
  padding: 10px 12px max(11px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 27, 30, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.harvey-input-row {
  display: grid;
  grid-template-columns: 1fr 42px 42px;
  gap: 7px;
  align-items: center;
  padding: 5px;
  border-radius: 16px;
  background: #fff;
}

.harvey-input {
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  color: #1d292b;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
}

.harvey-input:focus {
  outline: none;
}

.harvey-mic,
.harvey-send {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--harvey-bg);
  font-size: 1.05rem;
  cursor: pointer;
}

.harvey-mic.is-listening {
  background: #a92f35;
  animation: harvey-pulse 1s infinite;
}

.harvey-note {
  margin: 7px 3px 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.7rem;
  text-align: center;
}

@keyframes harvey-pulse {
  50% { transform: scale(1.08); }
}

@media (max-width: 640px) {
  .harvey-launcher {
    width: 70px;
    height: 70px;
    right: 16px;
    bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px));
  }

  .harvey-greeting {
    right: max(96px, calc(env(safe-area-inset-right) + 96px));
    bottom: max(25px, calc(env(safe-area-inset-bottom) + 17px));
    max-width: calc(100vw - 116px);
    padding: 9px 11px;
    font-size: 0.82rem;
  }

  .harvey-overlay {
    padding: 14px;
  }

  .harvey-shell {
    width: 90vw;
    height: min(75vh, 620px);
    max-height: calc(100vh - 28px);
    border-radius: 22px;
  }

  .harvey-main {
    padding: 12px;
  }

  .harvey-welcome {
    grid-template-columns: 98px 1fr;
    gap: 10px;
    padding: 10px 54px 10px 10px;
  }

  .harvey-welcome img {
    width: 98px;
    height: 108px;
  }

  .harvey-welcome h2 {
    font-size: 1.22rem;
  }

  .harvey-welcome p {
    font-size: 0.82rem;
  }
}

@media (max-height: 620px) {
  .harvey-shell {
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }

  .harvey-welcome {
    grid-template-columns: 68px 1fr;
  }

  .harvey-welcome img {
    width: 68px;
    height: 76px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .harvey-launcher,
  .harvey-greeting,
  .harvey-mic.is-listening {
    transition: none;
    animation: none;
  }
}

.harvey-message-sources {
  margin: 4px 0 12px 44px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #666666;
}
.harvey-message-sources a {
  color: #006f6f;
  text-decoration: underline;
}

/* Harvey mobile refinements shared across all pages. */
.harvey-welcome p {
  color: rgba(255, 255, 255, 0.84);
}

.harvey-context-label {
  color: rgba(255, 255, 255, 0.72);
}

.harvey-note {
  color: rgba(255, 255, 255, 0.68);
}

.harvey-mic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
}

.harvey-mic::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5 11a7 7 0 0 0 14 0'/%3E%3Cpath d='M12 18v3'/%3E%3Cpath d='M9 21h6'/%3E%3C/svg%3E");
}

.harvey-mic svg {
  display: none;
}

@media (max-width: 640px) {
  .harvey-shell {
    height: auto;
    max-height: calc(100dvh - 28px);
  }

  .harvey-main {
    flex: 0 1 auto;
  }
}
