/* AI Markdown Sitemap — chatbot widget */

.ai-md-chat {
  --ai-md-bg: #f7f6f3;
  --ai-md-surface: #ffffff;
  --ai-md-ink: #1a1c1e;
  --ai-md-muted: #5c6570;
  --ai-md-line: rgba(26, 28, 30, 0.1);
  --ai-md-accent: #0f6b5c;
  --ai-md-accent-soft: color-mix(in srgb, var(--ai-md-accent) 14%, transparent);
  --ai-md-title: var(--ai-md-ink);
  --ai-md-user: #1a1c1e;
  --ai-md-bubble-user-bg: var(--ai-md-user);
  --ai-md-bubble-user-fg: #f8f7f4;
  --ai-md-bubble-assistant-bg: var(--ai-md-surface);
  --ai-md-bubble-assistant-fg: var(--ai-md-ink);
  --ai-md-radius: 18px;
  --ai-md-font: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;

  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 42rem;
  margin: 1.5rem auto;
  padding: 0.85rem;
  border: 1px solid var(--ai-md-line);
  border-radius: calc(var(--ai-md-radius) + 6px);
  background:
    radial-gradient(
      120% 80% at 0% 0%,
      color-mix(in srgb, var(--ai-md-accent) 10%, transparent),
      transparent 55%
    ),
    linear-gradient(180deg, #fbfaf7 0%, var(--ai-md-bg) 100%);
  color: var(--ai-md-ink);
  font-family: var(--ai-md-font);
  box-shadow: 0 14px 36px rgba(26, 28, 30, 0.06);
  transition:
    min-height 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    max-height 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.55s ease,
    box-shadow 0.55s ease;
}

.ai-md-chat.is-collapsed {
  min-height: 150px;
  max-height: 150px;
  padding: 0.55rem;
  box-shadow: 0 10px 28px rgba(26, 28, 30, 0.05);
  overflow: hidden;
}

.ai-md-chat.is-open {
  min-height: 28rem;
  max-height: min(72vh, 40rem);
  padding: 1rem 1rem 0.85rem;
}

.ai-md-chat *,
.ai-md-chat *::before,
.ai-md-chat *::after {
  box-sizing: border-box;
}

.ai-md-chat__expand {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.55s ease;
  pointer-events: none;
}

.ai-md-chat.is-open .ai-md-chat__expand {
  grid-template-rows: 1fr;
  opacity: 1;
  pointer-events: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.ai-md-chat__expand-inner {
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ai-md-chat.is-open .ai-md-chat__expand-inner {
  min-height: 14rem;
}

.ai-md-chat__header {
  padding: 0.15rem 0.35rem 0.85rem;
  border-bottom: 1px solid var(--ai-md-line);
}

.ai-md-chat__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--ai-md-title);
}

.ai-md-chat__subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--ai-md-muted);
}

.ai-md-chat__messages {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1rem 0.35rem;
  scroll-behavior: smooth;
  min-height: 0;
}

.ai-md-chat__msg {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: 92%;
  animation: ai-md-fade-up 0.28s ease both;
}

.ai-md-chat__msg--user {
  align-self: flex-end;
}

.ai-md-chat__msg--assistant {
  align-self: flex-start;
  align-items: flex-start;
  max-width: min(100%, 36rem);
  width: auto;
}

.ai-md-chat__bubble {
  padding: 0.75rem 0.95rem;
  border-radius: var(--ai-md-radius);
  font-size: 0.95rem;
  line-height: 1.55;
  word-wrap: break-word;
}

.ai-md-chat__msg--user .ai-md-chat__bubble {
  background: var(--ai-md-bubble-user-bg);
  color: var(--ai-md-bubble-user-fg);
  border-bottom-right-radius: 6px;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
}

.ai-md-chat__bubble--assistant {
  background: var(--ai-md-bubble-assistant-bg);
  color: var(--ai-md-bubble-assistant-fg);
  border: 1px solid var(--ai-md-line);
  border-bottom-left-radius: 6px;
  width: fit-content;
  max-width: 100%;
}

.ai-md-chat__bubble code {
  font-size: 0.86em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--ai-md-accent-soft);
}

.ai-md-chat__bubble .ai-md-chat__heading {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.ai-md-chat__bubble .ai-md-chat__heading:not(:first-child) {
  margin-top: 0.85rem;
}

.ai-md-chat__bubble h3.ai-md-chat__heading {
  font-size: 0.98rem;
}

.ai-md-chat__bubble h4.ai-md-chat__heading {
  font-size: 0.94rem;
}

.ai-md-chat__bubble .ai-md-chat__p {
  margin: 0 0 0.55rem;
}

.ai-md-chat__bubble .ai-md-chat__p:last-child,
.ai-md-chat__bubble .ai-md-chat__list:last-child,
.ai-md-chat__bubble .ai-md-chat__heading:last-child {
  margin-bottom: 0;
}

.ai-md-chat__bubble .ai-md-chat__list {
  margin: 0.2rem 0 0.65rem;
  padding-left: 1.15rem;
}

.ai-md-chat__bubble .ai-md-chat__list li {
  margin: 0.2rem 0;
}

.ai-md-chat__bubble .ai-md-chat__list li::marker {
  color: color-mix(in srgb, var(--ai-md-accent, #0f6b5c) 70%, #666);
}

.ai-md-chat__bubble .ai-md-chat__hr {
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  margin: 0.85rem 0;
}

.ai-md-chat__reasoning {
  margin: 0;
  padding: 0.4rem 0.65rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed color-mix(in srgb, var(--ai-md-accent) 35%, transparent);
  font-size: 0.75rem;
  color: var(--ai-md-muted);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.ai-md-chat__reasoning[hidden] {
  display: none !important;
}

.ai-md-chat__reasoning > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--ai-md-accent);
  user-select: none;
  font-size: 0.78rem;
}

.ai-md-chat__reasoning > summary::-webkit-details-marker {
  display: none;
}

.ai-md-chat__reasoning-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--ai-md-accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ai-md-accent) 45%, transparent);
  animation: ai-md-pulse 1.4s ease-out infinite;
}

.ai-md-chat__tools {
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ai-md-chat__tool {
  position: relative;
  padding-left: 0.85rem;
  opacity: 0.9;
  line-height: 1.3;
}

.ai-md-chat__tool::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4em;
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--ai-md-accent);
}

.ai-md-chat__tool.is-done {
  opacity: 0.65;
}

.ai-md-chat__tool.is-running {
  font-weight: 600;
  color: var(--ai-md-ink);
}

.ai-md-chat__reasoning-text {
  margin-top: 0.35rem;
  line-height: 1.35;
  max-height: 3.4rem;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-right: 0.15rem;
}

.ai-md-chat__reason-point {
  position: relative;
  padding-left: 0.75rem;
  margin: 0 0 0.2rem;
  animation: ai-md-fade-up 0.22s ease both;
}

.ai-md-chat__reason-point::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ai-md-accent) 55%, transparent);
}

.ai-md-chat__link {
  color: var(--ai-md-accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ai-md-chat__link:hover {
  filter: brightness(0.88);
}

.ai-md-chat__pulse {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ai-md-muted);
  font-size: 0.9rem;
}

.ai-md-chat__typing {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  min-height: 1.15em;
  padding: 0.1rem 0.05rem;
}

.ai-md-chat__typing span {
  display: block;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ai-md-accent) 55%, var(--ai-md-muted));
  opacity: 0.35;
  animation: ai-md-typing-dot 1.15s ease-in-out infinite;
}

.ai-md-chat__typing span:nth-child(2) {
  animation-delay: 0.18s;
}

.ai-md-chat__typing span:nth-child(3) {
  animation-delay: 0.36s;
}

.ai-md-chat__err {
  margin: 0.6rem 0 0;
  color: #9b2c2c;
  font-size: 0.88rem;
}

.ai-md-chat__err-actions {
  margin: 0.65rem 0 0;
}

.ai-md-chat__retry {
  appearance: none;
  border: 1px solid rgba(155, 44, 44, 0.35);
  background: #fff;
  color: #9b2c2c;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

.ai-md-chat__retry:hover,
.ai-md-chat__retry:focus-visible {
  background: rgba(155, 44, 44, 0.06);
  outline: none;
}

.ai-md-chat__notice {
  margin: 0.45rem 0 0;
  color: #9b2c2c;
  font-size: 0.82rem;
  line-height: 1.35;
}

.ai-md-chat__notice[hidden] {
  display: none !important;
}

.ai-md-chat__form {
  display: block;
  padding: 0;
  border-top: 0 !important;
  margin-top: 0;
  transition:
    margin-top 0.55s ease,
    padding-top 0.55s ease;
}

.ai-md-chat.is-open .ai-md-chat__form {
  margin-top: 0.55rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ai-md-line) !important;
}

.ai-md-chat .ai-md-chat__composer {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.35rem 0.35rem 0.35rem 1rem;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 1.55rem;
  background: var(--ai-md-surface);
}

.ai-md-chat .ai-md-chat__composer:hover,
.ai-md-chat .ai-md-chat__composer:focus,
.ai-md-chat .ai-md-chat__composer:focus-within {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: var(--ai-md-surface);
}

.ai-md-chat__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.ai-md-chat__ph {
  position: absolute;
  inset: 0 auto 0 0;
  right: 0;
  display: flex;
  align-items: center;
  padding: 0.65rem 0;
  color: var(--ai-md-ink);
  opacity: 0.72;
  font-size: 0.98rem;
  line-height: 1.4;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    opacity 0.28s ease,
    transform 0.28s ease;
}

.ai-md-chat__ph.is-swap {
  opacity: 0;
  transform: translateY(4px);
}

.ai-md-chat__field.is-filled .ai-md-chat__ph,
.ai-md-chat__field.is-focused:not(.is-empty) .ai-md-chat__ph {
  opacity: 0;
  visibility: hidden;
}

.ai-md-chat .ai-md-chat__input,
.ai-md-chat .ai-md-chat__input:hover,
.ai-md-chat .ai-md-chat__input:focus,
.ai-md-chat .ai-md-chat__input:focus-visible,
.ai-md-chat .ai-md-chat__input:active {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 2.55rem;
  max-height: 9.5rem;
  width: 100%;
  height: auto;
  padding: 0.65rem 0 !important;
  margin: 0 !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--ai-md-ink);
  font: inherit;
  font-size: 0.98rem;
  line-height: 1.4;
  resize: none;
  overflow-y: auto;
  field-sizing: content;
  -webkit-appearance: none;
  appearance: none;
}

.ai-md-chat .ai-md-chat__input::placeholder {
  color: var(--ai-md-ink);
  opacity: 0.72;
}

.ai-md-chat__send {
  flex: 0 0 auto;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.45rem;
  height: 2.45rem;
  margin-bottom: 0.05rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--ai-md-accent);
  color: #fff;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease,
    filter 0.15s ease;
}

.ai-md-chat__send-icon {
  display: block;
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  /* Optical center: Lucide send is weighted toward top-right */
  transform: translate(-0.5px, 0.5px);
  pointer-events: none;
}

.ai-md-chat__send:hover {
  filter: brightness(0.92);
}

.ai-md-chat__send:active {
  transform: scale(0.96);
}

.ai-md-chat.is-busy .ai-md-chat__send {
  opacity: 0.55;
  pointer-events: none;
}

.ai-md-chat-unavailable {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: #fff4e5;
  color: #7a4b00;
}

@keyframes ai-md-fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ai-md-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ai-md-accent) 45%, transparent);
  }
  70% {
    box-shadow: 0 0 0 8px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@keyframes ai-md-typing-dot {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: translateY(0) scale(0.92);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px) scale(1);
  }
}

.ai-md-chat__msg--assistant.is-unmet .ai-md-chat__bubble--assistant {
  border-color: rgba(154, 103, 0, 0.35);
  background: #fffaf0;
}

@media (max-width: 640px) {
  .ai-md-chat.is-open {
    min-height: 24rem;
    max-height: 75vh;
    margin: 1rem 0;
    padding: 0.85rem 0.8rem 0.75rem;
    border-radius: 16px;
  }

  .ai-md-chat__msg {
    max-width: 100%;
  }
}

/* —— Floating help-desk tab + dock —— */

.ai-md-chat-tab {
  position: fixed;
  top: var(--ai-md-tab-top, 42%);
  left: var(--ai-md-tab-inset, 29px);
  right: auto;
  z-index: 99990;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--ai-md-tab-icon-gap, 0.55rem);
  min-width: 2.75rem;
  min-height: 10.5rem;
  padding: var(--ai-md-tab-pad-y, 0.85rem) var(--ai-md-tab-pad-x, 0.55rem);
  margin: 0;
  border: 0;
  border-radius: 10px;
  background: var(--ai-md-tab-bg, var(--ai-md-accent, #0f6b5c));
  color: var(--ai-md-tab-fg, #fff);
  cursor: pointer;
  box-shadow: 4px 8px 24px rgba(0, 0, 0, 0.18);
  transform: translateY(-50%);
  transition:
    filter 0.15s ease,
    transform 0.15s ease;
}

.ai-md-chat-tab.is-right {
  left: auto;
  right: var(--ai-md-tab-inset, 29px);
}

.ai-md-chat-tab:hover {
  filter: brightness(1.06);
}

.ai-md-chat-tab:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.ai-md-chat-tab__icon {
  display: block;
  width: var(--ai-md-tab-icon-size, 1.65rem);
  height: var(--ai-md-tab-icon-size, 1.65rem);
  object-fit: contain;
  flex-shrink: 0;
  transform: translate(
    var(--ai-md-tab-icon-x, 0px),
    var(--ai-md-tab-icon-y, 0px)
  );
  order: var(--ai-md-tab-icon-order, 0);
}

.ai-md-chat-tab__icon[hidden] {
  display: none !important;
}

.ai-md-chat-tab__icon-default {
  display: flex;
  order: var(--ai-md-tab-icon-order, 0);
  transform: translate(
    var(--ai-md-tab-icon-x, 0px),
    var(--ai-md-tab-icon-y, 0px)
  );
}

.ai-md-chat-tab__icon-default[hidden] {
  display: none !important;
}

.ai-md-chat-tab__icon-svg {
  display: block;
  width: var(--ai-md-tab-icon-size, 1.45rem);
  height: var(--ai-md-tab-icon-size, 1.45rem);
  flex-shrink: 0;
  color: inherit;
}

.ai-md-chat-tab__label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: var(--ai-md-tab-font-size, 0.78rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.1;
  white-space: nowrap;
  order: 1;
}

.ai-md-chat-tab.is-icon-bottom {
  --ai-md-tab-icon-order: 2;
}

.ai-md-chat-dock {
  position: fixed;
  z-index: 99991;
  left: 3.5rem;
  top: 12px;
  display: flex;
  flex-direction: column;
  width: min(26rem, calc(100vw - 4.5rem));
  max-width: calc(100vw - 1.5rem);
  height: 150px;
  max-height: calc(100vh - 24px);
  padding: 0.65rem 0.65rem 0.75rem;
  border-radius: 18px;
  background: #fbfaf7;
  border: 1px solid rgba(26, 28, 30, 0.1);
  box-shadow: 0 22px 50px rgba(26, 28, 30, 0.18);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  /* Solo fade in apertura; top/height animati solo con .is-expanding */
  transition: opacity 0.35s ease;
}

.ai-md-chat-dock[hidden] {
  display: none !important;
}

.ai-md-chat-dock.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.ai-md-chat-dock.is-expanding {
  transition:
    height 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    max-height 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    top 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease;
}

.ai-md-chat-dock.is-expanded {
  height: min(40rem, calc(100vh - 24px));
}

.ai-md-chat-dock__close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(26, 28, 30, 0.06);
  color: #1a1c1e;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.ai-md-chat-dock__close:hover {
  background: rgba(26, 28, 30, 0.12);
}

.ai-md-chat--floating {
  margin: 0;
  max-width: none;
  width: 100%;
  height: 100%;
  min-height: 0 !important;
  max-height: none !important;
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0.35rem 0.15rem 0.15rem;
  overflow: hidden;
}

.ai-md-chat-dock.is-expanded .ai-md-chat--floating {
  padding: 1.6rem 0.15rem 0.15rem;
}

.ai-md-chat--floating.is-collapsed {
  min-height: 0 !important;
  max-height: none !important;
}

.ai-md-chat--floating.is-open {
  min-height: 0 !important;
  max-height: none !important;
}

.ai-md-chat--floating .ai-md-chat__expand {
  flex: 1 1 auto;
}

.ai-md-chat--floating.is-open .ai-md-chat__expand-inner {
  min-height: 0;
  flex: 1 1 auto;
}

/* —— Presets + disclaimer —— */

.ai-md-chat__presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0 0.15rem;
  position: relative;
}

/* After the first message: keep only the “…” control so presets stay reachable. */
.ai-md-chat.is-open .ai-md-chat__presets,
.ai-md-chat__presets.is-compact {
  justify-content: flex-end;
  margin-top: 0.45rem;
}

.ai-md-chat.is-open .ai-md-chat__presets > .ai-md-chat__preset,
.ai-md-chat__presets.is-compact > .ai-md-chat__preset {
  display: none;
}

.ai-md-chat.is-open .ai-md-chat__presets .ai-md-chat__preset-more-wrap,
.ai-md-chat__presets.is-compact .ai-md-chat__preset-more-wrap {
  display: inline-flex;
}

.ai-md-chat__preset {
  appearance: none;
  margin: 0;
  padding: 0.45rem 0.9rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: #fff;
  color: #1a1c1e;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.3;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.ai-md-chat__preset:hover,
.ai-md-chat__preset:focus-visible {
  background: #f7f7f8;
  border-color: rgba(0, 0, 0, 0.2);
  outline: none;
}

.ai-md-chat__preset-more-wrap {
  position: relative;
  display: inline-flex;
}

.ai-md-chat__preset-more {
  appearance: none;
  margin: 0;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: #fff;
  color: #5c5c5c;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ai-md-chat__preset-more:hover,
.ai-md-chat__preset-more:focus-visible,
.ai-md-chat__preset-more[aria-expanded="true"] {
  background: #f7f7f8;
  border-color: rgba(0, 0, 0, 0.2);
  outline: none;
}

.ai-md-chat__preset-overlay {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.45rem);
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 12rem;
  max-width: min(20rem, 80vw);
  padding: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.ai-md-chat__preset-overlay[hidden] {
  display: none;
}

.ai-md-chat__preset-overlay .ai-md-chat__preset {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  white-space: normal;
}

.ai-md-chat__preset-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.ai-md-chat__preset-link {
  font-weight: 500;
}

.ai-md-chat__lang {
  position: relative;
  display: flex;
  justify-content: flex-end;
  margin: 0 0 0.55rem;
  padding: 0 0.1rem;
  z-index: 5;
}

.ai-md-chat__lang-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.35rem 0.65rem 0.35rem 0.55rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #3d3d3d;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.ai-md-chat__lang-btn:hover,
.ai-md-chat__lang-btn:focus-visible,
.ai-md-chat__lang-btn[aria-expanded="true"] {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  outline: none;
}

.ai-md-chat__lang-btn-main {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.ai-md-chat__lang-icon {
  flex-shrink: 0;
  color: var(--ai-md-accent, #0f6b5c);
}

.ai-md-chat__lang-current {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-md-chat__lang-chevron {
  flex-shrink: 0;
  opacity: 0.55;
  transition: transform 0.15s ease;
}

.ai-md-chat__lang-btn[aria-expanded="true"] .ai-md-chat__lang-chevron {
  transform: rotate(180deg);
}

.ai-md-chat__lang-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.4rem);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 11.5rem;
  max-width: min(16rem, 85vw);
  padding: 0.35rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.ai-md-chat__lang-menu[hidden] {
  display: none;
}

.ai-md-chat__lang-option {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #1a1c1e;
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.ai-md-chat__lang-option:hover,
.ai-md-chat__lang-option:focus-visible {
  background: #f4f5f6;
  outline: none;
}

.ai-md-chat__lang-option.is-active {
  background: color-mix(in srgb, var(--ai-md-accent, #0f6b5c) 12%, #fff);
}

.ai-md-chat__lang-option-label {
  font-weight: 550;
}

.ai-md-chat__lang-option-hint,
.ai-md-chat__lang-option-code {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: #8a8a8a;
  letter-spacing: 0.02em;
}

.ai-md-chat__lang-option-code {
  font-weight: 600;
  text-transform: uppercase;
}

.ai-md-chat__lang-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ai-md-chat__disclaimer {
  display: none;
  margin: 0.65rem 0 0;
  padding: 0 0.35rem;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #8e8e8e;
}

.ai-md-chat.is-open .ai-md-chat__disclaimer {
  display: block;
}

.ai-md-chat__disclaimer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ai-md-chat__disclaimer a:hover {
  color: var(--ai-md-ink);
}

.ai-md-chat__hero {
  display: none;
}

/* —— Theme: OpenAI / hero —— */

.ai-md-chat--theme-openai {
  --ai-md-bg: #ffffff;
  --ai-md-surface: #ffffff;
  --ai-md-ink: #0d0d0d;
  --ai-md-muted: #8e8e8e;
  --ai-md-line: rgba(0, 0, 0, 0.1);
  --ai-md-user: #0d0d0d;
  --ai-md-radius: 28px;
  max-width: 48rem;
  margin: 2rem auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ai-md-chat--theme-openai.is-collapsed {
  min-height: 0;
  max-height: none;
  padding: 0;
  overflow: visible;
}

.ai-md-chat--theme-openai.is-open {
  min-height: 28rem;
  max-height: min(72vh, 42rem);
  padding: 0;
}

.ai-md-chat--theme-openai .ai-md-chat__hero {
  display: block;
  text-align: center;
  padding: 0.5rem 1rem 1.25rem;
}

.ai-md-chat--theme-openai.is-open .ai-md-chat__hero {
  display: none;
}

.ai-md-chat--theme-openai .ai-md-chat__hero .ai-md-chat__title {
  font-size: clamp(1.55rem, 3.5vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--ai-md-title);
}

.ai-md-chat--theme-openai .ai-md-chat__hero .ai-md-chat__subtitle {
  margin-top: 0.4rem;
  font-size: 0.95rem;
  color: var(--ai-md-muted);
}

.ai-md-chat--theme-openai .ai-md-chat__composer,
.ai-md-chat--theme-openai .ai-md-chat__composer:hover,
.ai-md-chat--theme-openai .ai-md-chat__composer:focus,
.ai-md-chat--theme-openai .ai-md-chat__composer:focus-within {
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-radius: 999px !important;
  background: #fff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  padding: 0.35rem 0.4rem 0.35rem 1rem !important;
}

.ai-md-chat--theme-openai .ai-md-chat__send {
  background: #ececec !important;
  color: #5c5c5c !important;
}

.ai-md-chat--theme-openai .ai-md-chat__send:hover,
.ai-md-chat--theme-openai.is-busy .ai-md-chat__send,
.ai-md-chat--theme-openai .ai-md-chat__form:valid .ai-md-chat__send {
  background: #0d0d0d !important;
  color: #fff !important;
}

.ai-md-chat--theme-openai .ai-md-chat__ph {
  color: #8e8e8e;
}

.ai-md-chat--theme-openai.is-open .ai-md-chat__form {
  border-top: 0 !important;
  margin-top: 0.35rem;
  padding-top: 0;
}

.ai-md-chat--theme-openai .ai-md-chat__presets {
  margin-top: 1rem;
}

.ai-md-chat--theme-openai .ai-md-chat__messages {
  padding: 0.5rem 0.25rem 1rem;
}

@media (max-width: 640px) {
  .ai-md-chat-dock {
    left: 0.75rem !important;
    right: 0.75rem !important;
    top: auto !important;
    bottom: 0.75rem;
    width: auto;
    height: 150px;
    max-height: calc(100vh - 1.5rem);
  }

  .ai-md-chat-dock.is-expanded {
    height: min(78vh, calc(100vh - 1.5rem));
  }

  .ai-md-chat-tab {
    top: auto;
    bottom: 1.25rem;
    transform: none;
    min-height: 7.5rem;
  }

  .ai-md-chat-tab.is-right {
    bottom: 1.25rem;
  }

  .ai-md-chat--theme-openai .ai-md-chat__presets {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
  }

  .ai-md-chat--theme-openai .ai-md-chat__preset {
    flex: 0 0 auto;
  }
}
