.aico-chat-modal.coze-ready {
  grid-template-rows: 76px minmax(0, 1fr) !important;
}

.aico-chat-modal.coze-ready .aico-chat-body {
  padding: 0 !important;
  overflow: hidden !important;
  background: #fff !important;
}

.aico-chat-modal.coze-ready .aico-chat-fallback,
.aico-chat-modal.coze-ready > .aico-chat-input,
.aico-chat-modal.coze-ready .aico-chat-disclaimer {
  display: none !important;
}

.aico-chat-modal.coze-ready .aico-coze-host {
  display: block !important;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.aico-chat-modal.coze-ready .aico-chat-close { margin-left: 0 !important; }

.aico-unified-chat {
  --aico-blue: #315ff5;
  --aico-blue-soft: #eef3ff;
  --aico-text: #273043;
  --aico-muted: #8290a8;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #fff;
  color: var(--aico-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.aico-service-status {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 8px 20px;
  border-bottom: 1px solid #eef1f6;
  background: #f8faff;
  color: #6f7e96;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
}

.aico-service-status.is-human { color: #137a46; background: #f0fbf5; }
.aico-service-status.is-closed { color: #9a6500; background: #fff8e8; }

.aico-message-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 24px 12px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.aico-welcome {
  max-width: 560px;
  margin: 10px auto 20px;
  text-align: center;
}

.aico-welcome-avatar {
  display: block;
  width: 92px;
  height: 92px;
  margin: 0 auto 12px;
  border-radius: 24px;
  object-fit: cover;
  background: var(--aico-blue-soft);
}

.aico-welcome h3 { margin: 0 0 16px; font-size: 24px; color: #273043; }
.aico-welcome p {
  margin: 0 0 12px;
  padding: 16px 18px;
  border-radius: 14px;
  background: #f3f5f9;
  font-size: 16px;
  line-height: 1.65;
  text-align: left;
}

.aico-welcome-questions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.aico-quick-question {
  max-width: 100%;
  padding: 10px 16px;
  border: 1px solid #ccd5e6;
  border-radius: 12px;
  background: #fff;
  color: #344056;
  font-size: 15px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}
.aico-quick-question:hover, .aico-quick-question:focus-visible { border-color: var(--aico-blue); color: var(--aico-blue); outline: none; }

.aico-chat-row { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 18px; }
.aico-chat-row-visitor { flex-direction: row-reverse; }
.aico-chat-row-system { justify-content: center; margin: 12px 0 18px; }
.aico-message-avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--aico-blue-soft);
}
.aico-chat-row-ai .aico-message-avatar { border-radius: 50%; background: #fff; }
.aico-message-wrap { display: flex; flex-direction: column; align-items: flex-start; max-width: min(78%, 520px); }
.aico-chat-row-visitor .aico-message-wrap { align-items: flex-end; }
.aico-chat-row-system .aico-message-wrap { max-width: 90%; align-items: center; }
.aico-message-sender { margin: 0 0 5px; color: #7e8ba0; font-size: 12px; }
.aico-human-tag { margin-left: 6px; padding: 2px 5px; border-radius: 5px; background: #e7f8ef; color: #168451; font-size: 10px; }
.aico-answer-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 148px;
  margin: 0 0 10px;
  padding: 11px 14px;
  border-radius: 12px;
  background: #f3f5f9;
  color: #59677e;
  font-size: 13px;
  font-weight: 600;
}
.aico-answer-state.is-complete { color: #37a552; }
.aico-answer-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
}
.aico-answer-state-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #cfdaff;
  border-top-color: var(--aico-blue);
  border-radius: 50%;
  animation: aicoSpin .8s linear infinite;
}
@keyframes aicoSpin { to { transform: rotate(360deg); } }
.aico-message-bubble {
  padding: 12px 15px;
  border-radius: 4px 15px 15px 15px;
  background: #f2f4f8;
  color: #273043;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.aico-chat-row-agent .aico-message-bubble { background: #eef8f3; border: 1px solid #d9f0e4; }
.aico-chat-row-visitor .aico-message-bubble { border-radius: 15px 4px 15px 15px; background: #dfe5ff; }
.aico-chat-row-system .aico-message-bubble { padding: 7px 12px; border-radius: 999px; background: #f5f6f8; color: #8893a5; font-size: 12px; text-align: center; }
.aico-message-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin-top: 7px;
}
.aico-chat-row-visitor .aico-message-footer { justify-content: flex-end; }
.aico-message-details { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.aico-message-time, .aico-message-metrics { color: #9da8b9; font-size: 10px; white-space: nowrap; }
.aico-message-actions { display: inline-flex; align-items: center; gap: 4px; }
.aico-message-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #778399;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.aico-message-action:hover, .aico-message-action:focus-visible { background: #eef2f8; color: var(--aico-blue); outline: none; }
.aico-message-action.is-success { color: #37a552; }
.aico-streaming-bubble::after { content: ''; display: inline-block; width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -.15em; background: var(--aico-blue); animation: aicoCursor .8s steps(1) infinite; }
@keyframes aicoCursor { 50% { opacity: 0; } }

.aico-follow-ups {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  max-width: min(78%, 520px);
  margin: -7px 0 20px 48px;
}
.aico-follow-up {
  max-width: 100%;
  padding: 10px 15px;
  border: 1px solid #cdd6e7;
  border-radius: 11px;
  background: #fff;
  color: #344056;
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
}
.aico-follow-up:hover, .aico-follow-up:focus-visible { border-color: var(--aico-blue); color: var(--aico-blue); outline: none; }

.aico-typing { flex: 0 0 auto; padding: 4px 30px 10px 72px; color: #8a96aa; }
.aico-typing span { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: #8095dd; animation: aicoTyping 1.1s infinite ease-in-out; }
.aico-typing span:nth-child(2) { animation-delay: .15s; }
.aico-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes aicoTyping { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

.aico-message-composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid #edf0f5;
  background: #fff;
}
.aico-message-composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 46px;
  max-height: 100px;
  resize: none;
  padding: 12px 16px;
  border: 1px solid #cfd7e6;
  border-radius: 23px;
  box-shadow: none;
  color: #273043;
  font: inherit;
  line-height: 20px;
  outline: none;
}
.aico-message-composer textarea:focus { border-color: var(--aico-blue); box-shadow: 0 0 0 3px rgba(49, 95, 245, .1); }
.aico-message-composer textarea:disabled { background: #f4f5f7; cursor: not-allowed; }
.aico-message-send {
  flex: 0 0 auto;
  min-width: 66px;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 22px;
  background: var(--aico-blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.aico-message-send:disabled { opacity: .45; cursor: not-allowed; }
.aico-inline-error { margin: 8px auto 16px; padding: 8px 12px; border-radius: 8px; background: #fff1f0; color: #b42318; font-size: 12px; text-align: center; }

.aico-speech-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #d9e2f3;
  border-radius: 999px;
  background: #f7f9fd;
  color: #71809a;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}
.aico-speech-toggle.is-enabled { border-color: #c9d8ff; background: #edf3ff; color: #315ff5; }
.aico-speech-toggle.is-speaking { box-shadow: 0 0 0 3px rgba(49, 95, 245, .12); }
.aico-speech-icon { font-size: 15px; line-height: 1; }

@media (max-width: 767px) {
  .aico-chat-modal.coze-ready { grid-template-rows: 70px minmax(0, 1fr) !important; }
  .aico-message-list { padding: 16px 14px 8px; }
  .aico-service-status { padding-left: 12px; padding-right: 12px; }
  .aico-welcome { margin-top: 4px; }
  .aico-welcome-avatar { width: 78px; height: 78px; }
  .aico-welcome h3 { font-size: 21px; }
  .aico-welcome p { font-size: 15px; }
  .aico-message-wrap { max-width: 82%; }
  .aico-follow-ups { max-width: 82%; margin-left: 44px; }
  .aico-message-composer { padding: 10px 12px 14px; }
}

@media (max-width: 420px) {
  .aico-speech-toggle { width: 34px; height: 34px; padding: 7px; }
  .aico-speech-label { display: none; }
  .aico-message-avatar { width: 34px; height: 34px; flex-basis: 34px; }
  .aico-message-bubble { padding: 10px 12px; font-size: 14px; }
  .aico-answer-state { min-width: 132px; padding: 9px 12px; }
  .aico-message-footer { gap: 8px; }
  .aico-message-metrics { font-size: 9px; }
  .aico-message-send { min-width: 54px; padding: 0 12px; }
}
