.conversation-ai {
  --ai-bg: #fbfcfa;
  --ai-card: #fff;
  --ai-ink: #1d382f;
  --ai-muted: #65796f;
  --ai-line: #e0e9e2;
  --ai-soft: #eff5ef;
  color: var(--ai-ink);
  background: var(--ai-bg);
  border: 1px solid var(--ai-line);
  border-radius: 24px;
  padding: 0;
  width: min(840px, calc(100vw - 40px));
  height: min(840px, 90dvh);
  max-height: 90dvh;
  box-shadow: 0 35px 120px #092e3c45;
  overflow: hidden;
  animation: ai-open 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ai-answer-sources {
  margin-top: 12px;
}
.ai-answer-sources > summary,
.ai-answer-method > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--ai-muted);
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
  list-style: none;
}
.ai-answer-sources > summary svg {
  width: 14px;
  height: 14px;
}
.ai-answer-sources[open] > summary svg {
  transform: rotate(180deg);
}
.ai-answer-method {
  margin-top: 4px;
}
.ai-answer-method p {
  color: var(--ai-muted);
  font-size: 11px;
  line-height: 1.6;
  margin: 6px 0;
}
.conversation-ai[open] {
  display: flex;
  flex-direction: column;
}
.conversation-ai::backdrop {
  background: #102b2660;
  backdrop-filter: blur(9px);
}
[data-theme="dark"] .conversation-ai {
  --ai-bg: #13241f;
  --ai-card: #192e26;
  --ai-ink: #e4eee7;
  --ai-muted: #abc0b1;
  --ai-line: #30463a;
  --ai-soft: #21392e;
}
.conversation-ai-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 28px 18px;
  flex-shrink: 0;
}
.conversation-ai-header h2 {
  font-size: 21px;
  margin: 4px 0 0;
  letter-spacing: -0.6px;
}
.conversation-ai-header .icon-button {
  margin-left: auto;
  color: var(--ai-muted);
}
.ai-signature,
.ai-welcome-symbol {
  display: grid;
  place-items: center;
  border: 1px solid #9db7a448;
  background: linear-gradient(145deg, #edf6df, #c9e8dc);
  color: #265d45;
  border-radius: 15px;
  width: 47px;
  height: 47px;
  flex-shrink: 0;
}
.ai-kicker {
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 1.8px;
  color: var(--ai-muted);
}
.ai-scope {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 28px 17px;
  font-size: 11px;
  color: var(--ai-muted);
}
.ai-scope svg {
  width: 15px;
  height: 15px;
}
.ai-scope strong {
  color: var(--ai-ink);
}
.ai-scope > span {
  margin-left: auto;
}
.ai-tabs {
  display: flex;
  padding: 0 28px;
  gap: 25px;
  border-bottom: 1px solid var(--ai-line);
  flex-shrink: 0;
}
.ai-tabs button {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 45px;
  padding: 8px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ai-muted);
  font-size: 12px;
  font-weight: 650;
}
.ai-tabs button svg {
  width: 15px;
  height: 15px;
}
.ai-tabs [aria-pressed="true"] {
  color: var(--ai-ink);
  border-bottom-color: #46a77d;
}
.ai-settings {
  padding: 0 28px;
  flex-shrink: 0;
  max-height: 34%;
  overflow: auto;
  background: var(--ai-soft);
}
.ai-settings:empty {
  display: none;
}
.ai-notice {
  display: flex;
  gap: 9px;
  padding: 12px 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--ai-muted);
}
.ai-notice svg {
  width: 16px;
  flex-shrink: 0;
}
.ai-settings a {
  color: var(--ai-ink);
  text-decoration: underline;
}
.ai-settings p {
  font-size: 11px;
  line-height: 1.7;
  color: var(--ai-muted);
  margin: 10px 0;
}
.ai-settings small {
  font-size: 10px;
  color: var(--ai-muted);
}
.ai-consent summary,
.ai-controls summary {
  cursor: pointer;
  list-style: none;
  padding: 13px 0;
  font-size: 11px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}
.ai-consent summary svg {
  width: 14px;
  height: 14px;
}
.ai-consent summary span {
  font-size: 8px;
  letter-spacing: 1px;
  margin-left: auto;
  color: var(--ai-muted);
}
.ai-consent-check {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  font-size: 11px;
  line-height: 1.6;
  margin: 12px 0;
}
.ai-consent-check input {
  width: 17px !important;
  height: 17px !important;
  flex-shrink: 0;
  margin: 1px 0;
  accent-color: #2a8963;
}
.ai-key-note {
  border: 1px solid #c2a66c60;
  border-radius: 8px;
  padding: 10px;
  font-size: 11px;
  line-height: 1.8;
}
.ai-settings .button {
  font-size: 11px;
  min-height: 40px;
  margin-bottom: 12px;
}
.ai-text-button {
  background: none;
  border: 0;
  text-decoration: underline;
  color: var(--ai-muted);
  font-size: 11px;
  min-height: 42px;
  padding: 7px 10px;
  cursor: pointer;
}
.ai-ready {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  padding: 13px 0 2px;
}
.ai-ready svg {
  width: 15px;
  height: 15px;
  color: #369d73;
}
.ai-ready > span {
  margin-left: auto;
  color: var(--ai-muted);
  font-size: 10px;
}
.ai-controls summary {
  padding: 7px 0;
  min-height: 28px;
  font-size: 10px;
  font-weight: 450;
  color: var(--ai-muted);
}
.ai-settings progress {
  width: 100%;
  height: 5px;
  accent-color: #36a073;
}
.ai-delete-confirm {
  border-top: 1px solid var(--ai-line);
  padding: 8px 0;
}
.ai-feed {
  overflow-y: auto;
  padding: 22px 28px;
  flex: 1;
  min-height: 0;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.ai-welcome {
  text-align: center;
  padding: 22px 8px;
}
.ai-welcome-symbol {
  margin: 0 auto 18px;
  width: 55px;
  height: 55px;
  transform: rotate(-7deg);
}
.ai-welcome h3 {
  font-size: 29px;
  letter-spacing: -1px;
  font-weight: 650;
  margin: 10px 0;
}
.ai-welcome > p {
  font-size: 12px;
  line-height: 1.9;
  color: var(--ai-muted);
}
.ai-prompts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 23px auto 0;
  max-width: 540px;
}
.ai-prompts button {
  border: 1px solid var(--ai-line);
  border-radius: 12px;
  background: var(--ai-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  padding: 14px;
  color: var(--ai-ink);
  font-size: 11px;
  min-height: 48px;
  transition:
    transform 0.2s,
    border-color 0.2s;
}
.ai-prompts svg {
  width: 15px;
  height: 15px;
  color: var(--ai-muted);
}
.ai-prompts button:hover {
  transform: translateY(-2px);
  border-color: #7ba38a;
}
.ai-user-turn {
  max-width: 85%;
  width: fit-content;
  margin: 12px 0 22px auto;
  background: var(--ai-soft);
  padding: 12px 17px;
  border-radius: 17px 17px 4px 17px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ai-answer {
  margin-bottom: 27px;
  animation: ai-answer-in 0.25s ease;
}
.ai-answer-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ai-muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 1.1px;
}
.ai-answer-label svg {
  width: 15px;
  height: 15px;
}
.ai-answer-text {
  font-size: 14px;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 12px 0 16px;
}
.ai-inline-metrics {
  display: flex;
  gap: 8px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.ai-inline-metrics span {
  padding: 10px 15px;
  border: 1px solid var(--ai-line);
  border-radius: 10px;
  font-size: 10px;
  color: var(--ai-muted);
  flex: 1;
  min-width: 100px;
}
.ai-inline-metrics b {
  display: block;
  color: var(--ai-ink);
  font-size: 20px;
  letter-spacing: -0.6px;
  margin-bottom: 3px;
}
.ai-evidence-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ai-evidence {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--ai-card);
  border: 1px solid var(--ai-line);
  border-radius: 10px;
  padding: 12px;
  margin: 0 0 8px;
  color: var(--ai-ink);
  cursor: pointer;
  transition: border-color 0.2s;
}
.ai-evidence:hover {
  border-color: #67a083;
}
.ai-evidence > span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  flex-wrap: wrap;
}
.ai-evidence svg {
  width: 12px;
  height: 12px;
  color: var(--ai-muted);
  flex-shrink: 0;
}
.ai-evidence time {
  font-size: 9px;
  color: var(--ai-muted);
  margin-left: auto;
}
.ai-evidence p {
  font-size: 11px;
  line-height: 1.7;
  margin: 9px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ai-evidence small {
  font-size: 9px;
  color: var(--ai-muted);
}
.ai-coverage {
  display: block;
  font-size: 10px;
  color: var(--ai-muted);
  line-height: 1.7;
  margin-top: 12px;
}
.ai-insight,
.ai-topic {
  border: 1px solid var(--ai-line);
  background: var(--ai-soft);
  padding: 16px;
  border-radius: 14px;
  margin: 13px 0;
}
.ai-insight > small,
.ai-search-result > small {
  font-size: 10px;
  color: var(--ai-muted);
}
.ai-insight h4,
.ai-topic h4 {
  font-size: 14px;
  margin: 8px 0;
}
.ai-insight > p {
  font-size: 12px;
  line-height: 1.7;
  margin: 8px 0 14px;
}
.ai-topic header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ai-topic header span {
  font-size: 10px;
  color: var(--ai-muted);
}
.ai-topic-months {
  margin: 13px 0;
}
.ai-topic-months > div {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  margin: 6px 0;
}
.ai-topic-months meter {
  flex: 1;
  min-width: 0;
  height: 12px;
}
.ai-topic-months b {
  min-width: 16px;
}
.ai-error:empty {
  display: none;
}
.ai-error {
  margin: 0 28px 10px;
  border: 1px solid #c8866655;
  color: var(--ai-ink);
  background: var(--ai-soft);
  border-radius: 9px;
  padding: 10px 13px;
  font-size: 11px;
  line-height: 1.7;
  max-height: 100px;
  overflow: auto;
  flex-shrink: 0;
}
.ai-composer {
  display: flex;
  align-items: flex-end;
  margin: 0 28px 10px;
  border: 1px solid #8cae965e;
  box-shadow: 0 3px 12px #1a3a2510;
  border-radius: 15px;
  background: var(--ai-card);
  padding: 10px;
  gap: 10px;
  flex-shrink: 0;
}
.ai-composer:focus-within {
  border-color: #65a383;
  box-shadow: 0 0 0 3px #4b9e7912;
}
.ai-composer textarea {
  flex: 1;
  border: 0 !important;
  background: transparent !important;
  color: var(--ai-ink);
  outline: none;
  resize: none;
  padding: 9px !important;
  line-height: 1.5;
  font: inherit;
  font-size: 12px;
  min-height: 38px;
  max-height: 90px;
  box-shadow: none !important;
  width: 0;
}
.ai-composer button {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  min-width: 39px;
  border: 0;
  background: #286247;
  border-radius: 11px;
  color: #fff;
}
.ai-composer button svg {
  width: 18px;
}
.ai-composer button:disabled {
  opacity: 0.45;
  cursor: wait;
}
.ai-disclaimer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 30px 17px;
  font-size: 9px;
  line-height: 1.6;
  color: var(--ai-muted);
  flex-shrink: 0;
}
.ai-thinking {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 0 22px;
}
.ai-thinking > span {
  width: 5px;
  height: 5px;
  background: #5e9b7d;
  border-radius: 50%;
  animation: ai-think 1.1s infinite;
}
.ai-thinking > span:nth-child(2) {
  animation-delay: 0.14s;
}
.ai-thinking > span:nth-child(3) {
  animation-delay: 0.28s;
}
.ai-thinking small {
  margin-left: 8px;
  font-size: 11px;
  color: var(--ai-muted);
}
@keyframes ai-open {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes ai-answer-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes ai-think {
  50% {
    opacity: 0.3;
    transform: translateY(-3px);
  }
}
@media (max-width: 600px) {
  .conversation-ai {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .conversation-ai-header {
    padding: 18px 18px 12px;
  }
  .conversation-ai-header h2 {
    font-size: 18px;
  }
  .ai-scope {
    padding: 0 18px 12px;
    font-size: 10px;
  }
  .ai-scope > span {
    width: 100%;
    margin-left: 23px;
    font-size: 9px;
  }
  .ai-tabs {
    padding: 0 18px;
    gap: 0;
    justify-content: space-between;
  }
  .ai-tabs button {
    font-size: 11px;
  }
  .ai-settings {
    padding: 0 18px;
    max-height: 37%;
  }
  .ai-feed {
    padding: 18px;
  }
  .ai-welcome {
    padding: 20px 0;
  }
  .ai-welcome h3 {
    font-size: 25px;
  }
  .ai-prompts {
    gap: 7px;
  }
  .ai-prompts button {
    padding: 12px;
    font-size: 10px;
  }
  .ai-evidence-list {
    grid-template-columns: 1fr;
  }
  .ai-composer {
    margin: 0 14px 9px;
  }
  .ai-composer textarea {
    font-size: 16px;
  }
  .ai-disclaimer {
    padding: 0 18px max(12px, env(safe-area-inset-bottom));
    font-size: 8px;
  }
  .ai-disclaimer > span {
    display: none;
  }
  .ai-error {
    margin: 0 18px 9px;
  }
  .ai-consent summary span {
    font-size: 7px;
  }
  .ai-user-turn {
    font-size: 12px;
  }
  .ai-ready {
    flex-wrap: wrap;
  }
  .ai-ready > span {
    margin-left: 23px;
  }
  .ai-inline-metrics span {
    padding: 9px;
    min-width: 78px;
  }
  .ai-inline-metrics b {
    font-size: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .conversation-ai,
  .ai-answer,
  .ai-thinking > span {
    animation: none;
  }
  .ai-feed {
    scroll-behavior: auto;
  }
  .ai-prompts button {
    transition: none;
  }
}
