.ai-panel {
  position: fixed;
  z-index: 80;
  right: 20px;
  bottom: 84px;
  width: min(430px, calc(100vw - 40px));
  height: min(650px, calc(100svh - 116px));
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(.985);
  transform-origin: right bottom;
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}

.ai-panel.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  transition-delay: 0s;
}

.ai-panel-dialog {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(17, 24, 22, .22);
  border-radius: 8px;
  background: #f7f3ea;
  box-shadow: 0 24px 70px rgba(17, 24, 22, .26);
}

.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid rgba(17, 24, 22, .14);
  background: #111816;
  color: #f7f3ea;
}

.ai-panel-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-panel-heading img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: invert(1);
}

.ai-panel-heading span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.ai-panel-heading strong {
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-panel-heading small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(247, 243, 234, .68);
  font-size: 10px;
  line-height: 1.2;
}

.ai-panel-heading small::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #73c9a6;
  box-shadow: 0 0 0 3px rgba(115, 201, 166, .14);
}

.ai-panel-close {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(247, 243, 234, .22);
  background: transparent;
  color: #f7f3ea;
  font-family: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}

.ai-panel-close:hover,
.ai-panel-close:focus-visible {
  border-color: rgba(247, 243, 234, .56);
  background: rgba(247, 243, 234, .1);
  outline: none;
}

.ai-panel-body {
  position: relative;
  min-height: 0;
  background: #f7f3ea;
}

.ai-panel iframe {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  opacity: 0;
  transition: opacity .18s ease;
}

.ai-panel.is-ready iframe { opacity: 1; }

.ai-panel-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: rgba(17, 24, 22, .62);
  font-size: 12px;
  text-align: center;
  transition: opacity .18s ease;
}

.ai-panel.is-ready .ai-panel-loading {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 620px) {
  .ai-panel {
    right: 10px;
    bottom: 78px;
    width: calc(100vw - 20px);
    height: min(620px, calc(100svh - 96px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-panel,
  .ai-panel iframe,
  .ai-panel-loading { transition: none; }
}
