.assistant-modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.assistant-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 22px;
  color: #253f43;
  background: #14373c7d;
  opacity: 0;
  backdrop-filter: blur(11px);
  transition: opacity .16s ease;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.assistant-overlay[hidden] { display: none; }
.assistant-overlay.is-open { opacity: 1; }

.assistant-shell {
  width: min(820px, 100%);
  height: min(780px, calc(100dvh - 44px));
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #d7e6e3;
  border-radius: 27px;
  background:
    radial-gradient(circle at 100% 0, #ffe3d1 0, transparent 28%),
    radial-gradient(circle at 0 100%, #d9eee9 0, transparent 30%),
    #fffdf9;
  box-shadow: 0 30px 90px #15383d45;
  transform: translateY(10px);
  transition: transform .16s ease;
  touch-action: pan-y;
}

.assistant-overlay.is-open .assistant-shell { transform: translateY(0); }
.assistant-shell * { box-sizing: border-box; }

.assistant-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid #dfebe8;
}

.assistant-header > div > span,
.assistant-kicker {
  color: #dc7a63;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .16em;
}

.assistant-header h2 {
  margin: 5px 0 3px;
  color: #245e65;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(28px, 4vw, 39px);
}

.assistant-header p { margin: 0; color: #748689; font-size: 13px; line-height: 1.6; }

.assistant-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #537579;
  background: #e7f2ef;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.assistant-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 28px;
  border-bottom: 1px solid #e5efed;
  background: #f7fbfaaf;
}

.assistant-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  color: #607b7e;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.assistant-tabs button[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(135deg, #2b7378, #df8369);
  box-shadow: 0 7px 17px #2b697427;
}

.assistant-body {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 22px 28px 30px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.assistant-chat {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(220px, 1fr) auto auto;
  gap: 14px;
}

.assistant-notice {
  margin: 0;
  padding: 11px 13px;
  border: 1px solid #eadfcf;
  border-radius: 12px;
  color: #756f67;
  background: #fff9ef;
  font-size: 12px;
  line-height: 1.65;
}

.assistant-conversation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #6d8487;
  font-size: 12px;
  font-weight: 800;
}

.assistant-new-conversation {
  border: 1px solid #cfe0dc;
  border-radius: 999px;
  padding: 7px 12px;
  color: #2e6d70;
  background: #f1f8f6;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.assistant-new-conversation:disabled { cursor: wait; opacity: .55; }

.assistant-limit-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #efcfc5;
  border-radius: 13px;
  color: #8c554d;
  background: #fff3ef;
  font-size: 12px;
  line-height: 1.6;
}

.assistant-limit-notice[hidden] { display: none; }
.assistant-limit-notice .assistant-primary { flex: 0 0 auto; }

.assistant-messages {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 220px;
  overflow: auto;
  padding: 6px 3px 12px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.assistant-message {
  width: min(86%, 620px);
  display: grid;
  gap: 4px;
}

.assistant-message > span { color: #819194; font-size: 11px; font-weight: 800; }
.assistant-message p {
  margin: 0;
  padding: 12px 14px;
  border-radius: 5px 16px 16px;
  color: #345c61;
  background: #edf6f3;
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.assistant-message.is-user { justify-self: end; }
.assistant-message.is-user > span { justify-self: end; }
.assistant-message.is-user p {
  border-radius: 16px 5px 16px 16px;
  color: #fff;
  background: linear-gradient(145deg, #2c7176, #438f85);
}

.assistant-composer {
  display: grid;
  gap: 9px;
  padding-top: 13px;
  border-top: 1px solid #e0ebe8;
}

.assistant-composer textarea,
.assistant-feedback input,
.assistant-feedback textarea,
.assistant-feedback select {
  width: 100%;
  border: 1px solid #cbded9;
  border-radius: 12px;
  padding: 11px 13px;
  color: #294f54;
  background: #fff;
  font: inherit;
  line-height: 1.6;
}

.assistant-composer textarea,
.assistant-feedback textarea { resize: vertical; }

.assistant-composer-meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  color: #89989a;
  font-size: 11px;
}

.assistant-inline-status { justify-self: end; }

.assistant-primary {
  border: 0;
  border-radius: 11px;
  padding: 10px 17px;
  color: #fff;
  background: linear-gradient(135deg, #286a70, #3f8c82);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.assistant-primary:disabled { opacity: .55; cursor: wait; }

.assistant-feedback { max-width: 680px; margin: 0 auto; }
.assistant-feedback h3 {
  margin: 7px 0 6px;
  color: #285f67;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(27px, 4vw, 36px);
}

.assistant-feedback-copy { margin: 0 0 20px; color: #6e8285; line-height: 1.75; }
.assistant-feedback form { display: grid; gap: 14px; }
.assistant-feedback label { display: grid; gap: 7px; color: #536f72; font-size: 13px; font-weight: 800; }
.assistant-feedback label small { justify-self: end; color: #8c9a9c; font-weight: 400; }
.assistant-feedback-status { min-height: 21px; margin: 0; color: #718689; font-size: 13px; }
.assistant-feedback-status[data-tone="success"] { color: #2f7767; }
.assistant-feedback-status[data-tone="error"] { color: #a45148; }

.assistant-quick-button {
  position: fixed;
  z-index: 250;
  right: 14px;
  bottom: 14px;
  display: none;
  min-width: 58px;
  height: 46px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(145deg, #2b7075, #df8269);
  box-shadow: 0 12px 28px #1c52582d;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

.assistant-quick-button[hidden] { display: none !important; }

@media (max-width: 800px) {
  .assistant-quick-button { display: block; }
  .assistant-overlay { padding: 0; place-items: stretch; }
  .assistant-shell { width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
  .assistant-header { padding: 18px 18px 14px; }
  .assistant-header p { display: none; }
  .assistant-tabs { padding: 8px 14px; }
  .assistant-body { padding: 17px 14px max(28px, env(safe-area-inset-bottom)); }
  .assistant-message { width: 92%; }
}

@media (max-width: 420px) {
  .assistant-header h2 { font-size: 28px; }
  .assistant-limit-notice { align-items: stretch; flex-direction: column; }
  .assistant-limit-notice .assistant-primary { width: 100%; }
  .assistant-composer-meta { grid-template-columns: auto 1fr; }
  .assistant-composer-meta .assistant-primary { grid-column: 1 / -1; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-overlay,
  .assistant-shell { transition: none; }
}
