.button-ai {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--forest);
  border-radius: 2px;
  padding: 13px 18px;
  background: var(--forest);
  color: #fff;
  cursor: pointer;
  font-size: 0.93rem;
  font-weight: 760;
  line-height: 1;
}

.button-ai > span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: var(--terracotta);
  font-family: Georgia, "Times New Roman", serif;
}

.button-ai:hover {
  border-color: #172a2b;
  background: #172a2b;
  transform: translateY(-2px);
}

.huvia-ai {
  scroll-margin-top: 84px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 54px 0;
  background: var(--almond);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.huvia-ai[hidden] { display: none; }

.huvia-ai button,
.huvia-ai input { font: inherit; letter-spacing: 0; }

.huvia-ai__workspace {
  display: grid;
  min-height: 520px;
  grid-template-columns: minmax(280px, 0.72fr) minmax(560px, 1.28fr);
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 22px 54px rgba(16, 25, 27, 0.16);
}

.huvia-ai__intro {
  display: flex;
  flex-direction: column;
  padding: 38px;
  background: var(--forest);
  color: var(--off-white);
}

.huvia-ai__identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.huvia-ai__identity > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--terracotta);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.huvia-ai__identity div { display: grid; }
.huvia-ai__identity strong { font-size: 0.94rem; }
.huvia-ai__identity small { color: rgba(255, 255, 255, 0.62); font-size: 0.72rem; }

.huvia-ai__intro h2 {
  max-width: 360px;
  margin-top: 58px;
  color: var(--off-white);
  font-size: clamp(2rem, 2.7vw, 3.25rem);
  line-height: 1.02;
}

.huvia-ai__topics {
  display: grid;
  gap: 0;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.huvia-ai__topics button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  padding: 13px 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 680;
  text-align: left;
}

.huvia-ai__topics button:hover { color: #fff; }
.huvia-ai__topics button span { color: var(--ochre); }

.huvia-ai__conversation {
  display: grid;
  min-width: 0;
  grid-template-rows: auto 1fr auto auto;
  background: var(--paper);
}

.huvia-ai__conversation > header {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
}

.huvia-ai__conversation > header div { display: grid; gap: 2px; }
.huvia-ai__conversation > header strong { color: var(--forest); font-size: 0.94rem; }
.huvia-ai__conversation > header span { color: rgba(16, 25, 27, 0.52); font-size: 0.7rem; }

.huvia-ai__conversation > header button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--forest);
  cursor: pointer;
  font-size: 1.45rem;
  line-height: 1;
}

.huvia-ai__messages {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 28px 24px;
  overscroll-behavior: contain;
}

.huvia-ai__message {
  max-width: min(78%, 580px);
  border-left: 2px solid var(--terracotta);
  padding: 4px 0 4px 14px;
}

.huvia-ai__message p { margin: 0; font-size: 0.88rem; line-height: 1.58; }

.huvia-ai__message--user {
  align-self: flex-end;
  border-left: 0;
  border-right: 2px solid var(--sage);
  padding: 9px 14px 9px 0;
  color: var(--forest);
  text-align: right;
}

.huvia-ai__message a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 9px;
  color: var(--terracotta-dark);
  font-size: 0.76rem;
  font-weight: 760;
}

.huvia-ai__typing {
  display: flex;
  width: 42px;
  gap: 4px;
  border-left: 2px solid var(--terracotta);
  padding: 8px 0 8px 14px;
}

.huvia-ai__typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sage);
  animation: huvia-ai-typing 800ms infinite ease-in-out;
}

.huvia-ai__typing span:nth-child(2) { animation-delay: 100ms; }
.huvia-ai__typing span:nth-child(3) { animation-delay: 200ms; }

.huvia-ai__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin: 0 24px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}

.huvia-ai__form input {
  min-width: 0;
  height: 46px;
  border: 1px solid rgba(34, 54, 55, 0.22);
  border-radius: 2px;
  padding: 0 14px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 0.82rem;
}

.huvia-ai__form input:focus {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(208, 90, 58, 0.1);
}

.huvia-ai__form button {
  min-width: 92px;
  border: 1px solid var(--terracotta);
  border-radius: 2px;
  padding: 0 16px;
  background: var(--terracotta);
  color: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 760;
}

.huvia-ai__form button span { margin-left: 7px; }
.huvia-ai__form button:hover { background: var(--terracotta-dark); }

.huvia-ai__boundary {
  padding: 8px 24px 14px;
  color: rgba(16, 25, 27, 0.48);
  font-size: 0.65rem;
  text-align: center;
}

.huvia-ai .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@keyframes huvia-ai-typing {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 980px) {
  .huvia-ai__workspace { grid-template-columns: minmax(240px, 0.72fr) minmax(440px, 1.28fr); }
  .huvia-ai__intro { padding: 28px; }
}

@media (max-width: 760px) {
  .button-ai { width: 100%; justify-content: center; }
  .huvia-ai { scroll-margin-top: 72px; padding: 18px 0; }
  .huvia-ai__workspace { width: calc(100% - 28px); min-height: 0; grid-template-columns: 1fr; }
  .huvia-ai__intro { padding: 25px 22px; }
  .huvia-ai__intro h2 { margin-top: 30px; font-size: 2.35rem; }
  .huvia-ai__topics { margin-top: 30px; }
  .huvia-ai__conversation { min-height: 500px; }
  .huvia-ai__messages { max-height: 330px; padding: 22px 18px; }
  .huvia-ai__message { max-width: 90%; }
  .huvia-ai__form { margin: 0 18px; grid-template-columns: 1fr 76px; }
  .huvia-ai__form button { min-width: 0; padding: 0 10px; }
  .huvia-ai__boundary { padding-right: 18px; padding-left: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .huvia-ai__typing span { animation: none; }
}

.huvia-ai__message--user p {
  white-space: pre-line;
}
.huvia-ai__attachments {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 14px;
  background: rgba(87, 120, 110, 0.05);
}

.huvia-ai__attachments-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.huvia-ai__attachments-heading strong {
  color: var(--forest);
  font-size: 0.76rem;
}

.huvia-ai__attachments-heading span {
  color: rgba(16, 25, 27, 0.46);
  font-size: 0.62rem;
}

.huvia-ai__attachment-list {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.huvia-ai__attachment {
  display: grid;
  min-width: 0;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  border-top: 1px solid rgba(16, 25, 27, 0.08);
  padding-top: 8px;
}

.huvia-ai__attachment-type {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 3px;
  background: var(--forest);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 780;
}

.huvia-ai__attachment > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.huvia-ai__attachment strong {
  overflow: hidden;
  color: var(--forest);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.huvia-ai__attachment small {
  color: rgba(16, 25, 27, 0.5);
  font-size: 0.6rem;
  line-height: 1.35;
}