.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ai-chat {
  display: flex;
  width: min(22rem, 100%);
  flex: 0 0 min(22rem, 100%);
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid #2a3142;
  background: #121722;
  color: #e8edf5;
}

.ai-chat[hidden] {
  display: none;
}

.ai-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px solid #2a3142;
  padding: 0.65rem 0.75rem;
}

.ai-chat-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.ai-thread {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  overflow: auto;
  padding: 0.75rem;
}

.ai-msg {
  margin: 0;
  max-width: 92%;
  border-radius: 0.8rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.86rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.ai-msg.user {
  align-self: flex-end;
  background: #c45c26;
  color: #fff;
}

.ai-msg.assistant {
  align-self: flex-start;
  background: #1c2433;
  color: #d7deea;
}

.ai-msg.pending {
  opacity: 0.75;
}

.ai-findings {
  margin: 0.4rem 0 0;
  padding-left: 1rem;
}

.ai-composer {
  display: grid;
  gap: 0.45rem;
  border-top: 1px solid #2a3142;
  padding: 0.6rem;
}

.ai-composer textarea {
  width: 100%;
  min-height: 4.2rem;
  max-height: 8rem;
  resize: vertical;
}

.ai-composer-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ai-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
  border-radius: 0.7rem;
  background: #0d121b;
  padding: 0.25rem;
}

.ai-mode {
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: #b8c2d3;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.5rem 0.35rem;
}

.ai-mode:hover {
  color: #fff;
}

.ai-mode.is-active {
  background: #c45c26;
  color: #fff;
}

.ai-tip {
  margin: 0;
  color: #9aa6b8;
  font-size: 0.76rem;
  line-height: 1.4;
}

.ai-examples {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.ai-examples span {
  color: #9aa6b8;
  font-size: 0.74rem;
}

.ai-example {
  border: 1px solid #3a4458;
  border-radius: 0.6rem;
  background: transparent;
  color: #e8edf5;
  font-size: 0.8rem;
  line-height: 1.35;
  padding: 0.45rem 0.6rem;
  text-align: start;
}

.ai-example:hover {
  border-color: #c45c26;
}

.ai-icon {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border: 1px solid #3a4458;
  border-radius: 999px;
  background: transparent;
  color: #d7deea;
  padding: 0;
}

.ai-icon svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-icon.is-active,
.ai-send {
  border-color: #c45c26;
  background: #c45c26;
  color: #fff;
}

.ai-send {
  margin-left: auto;
}

.ai-send:disabled {
  opacity: 0.55;
}

.ai-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: #d7deea;
  font-size: 0.78rem;
}

.ai-attachment[hidden] {
  display: none;
}

@media (max-width: 800px) {
  .ai-chat {
    position: absolute;
    z-index: 35;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: min(46dvh, 24rem);
    flex: none;
    border-top: 1px solid #2a3142;
    border-left: 0;
  }
}
