#agentchat-menu,
#agentchat-menu * {
  box-sizing: border-box;
}

#agentchat-menu {
  display: block;
  margin-bottom: 4px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

#agentchat-menu .agentchat-nav-button {
  display: inline-flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: 14px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-align: left;
}

#agentchat-menu .agentchat-nav-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#agentchat-menu .agentchat-nav-button:hover,
#agentchat-menu .agentchat-nav-button.is-active {
  color: #2563eb;
  background: #eff6ff;
}

#agentchat-menu svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

#agentchat-shell {
  position: fixed;
  inset: 76px 16px 16px 324px;
  z-index: 9998;
  display: none;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.96)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(37, 99, 235, 0.045) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(37, 99, 235, 0.045) 31px 32px);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
  overflow: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

#agentchat-shell.is-open {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
}

#agentchat-shell button,
#agentchat-shell textarea,
#agentchat-shell select {
  font-family: inherit;
}

#agentchat-shell .agentchat-history {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.72);
}

#agentchat-shell .agentchat-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 18px 12px;
}

#agentchat-shell .agentchat-title {
  margin: 0;
  color: #0f172a;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
}

#agentchat-shell .agentchat-subtitle {
  margin-top: 4px;
  color: #64748b;
  font-size: 13px;
}

#agentchat-shell .agentchat-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 12px;
  color: #2563eb;
  background: #fff;
  cursor: pointer;
}

#agentchat-shell .agentchat-session-list {
  flex: 1;
  padding: 8px 16px;
  overflow: auto;
}

#agentchat-shell .agentchat-session {
  width: 100%;
  margin-bottom: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 14px;
  color: #334155;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

#agentchat-shell .agentchat-session.is-active {
  border-color: rgba(37, 99, 235, 0.46);
  background: #eff6ff;
}

#agentchat-shell .agentchat-session strong {
  display: block;
  margin-bottom: 6px;
  color: #0f172a;
  font-size: 14px;
}

#agentchat-shell .agentchat-note {
  margin: 16px;
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 12px;
  color: #2563eb;
  background: #eff6ff;
  font-size: 13px;
  line-height: 1.6;
}

#agentchat-shell .agentchat-main {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
}

#agentchat-shell .agentchat-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 20px 10px;
}

#agentchat-shell .agentchat-close {
  color: #64748b;
}

#agentchat-shell .agentchat-messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 40px clamp(18px, 4vw, 56px) 20px;
  overflow: auto;
}

#agentchat-shell .agentchat-empty {
  place-self: center;
  max-width: 420px;
  color: #64748b;
  text-align: center;
}

#agentchat-shell .agentchat-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  border-radius: 18px;
  color: #2563eb;
  background: #eff6ff;
}

#agentchat-shell .agentchat-empty h2 {
  margin: 0 0 10px;
  color: #0f172a;
  font-size: 22px;
}

#agentchat-shell .agentchat-message {
  max-width: min(760px, 84%);
  padding: 13px 15px;
  border-radius: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.7;
}

#agentchat-shell .agentchat-message.user {
  align-self: flex-end;
  color: #fff;
  background: #2563eb;
  border-bottom-right-radius: 6px;
}

#agentchat-shell .agentchat-message.assistant {
  align-self: flex-start;
  color: #0f172a;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-bottom-left-radius: 6px;
}

#agentchat-shell .agentchat-message.assistant.is-pending {
  color: #64748b;
}

#agentchat-shell .agentchat-composer-wrap {
  padding: 12px clamp(18px, 4vw, 56px) 24px;
}

#agentchat-shell .agentchat-composer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: end;
  max-width: 980px;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.1);
}

#agentchat-shell textarea {
  width: 100%;
  min-height: 52px;
  max-height: 160px;
  resize: none;
  border: 0;
  outline: 0;
  color: #0f172a;
  background: transparent;
  font-size: 15px;
  line-height: 1.6;
}

#agentchat-shell .agentchat-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

#agentchat-shell .agentchat-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#agentchat-shell .agentchat-controls span {
  color: #64748b;
  font-size: 13px;
  white-space: nowrap;
}

#agentchat-shell select {
  height: 38px;
  min-width: 132px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 12px;
  color: #2563eb;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  outline: 0;
}

#agentchat-shell .agentchat-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: #2563eb;
  cursor: pointer;
}

#agentchat-shell .agentchat-send:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 640px) {
  #agentchat-shell .agentchat-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
  }

  #agentchat-shell .agentchat-controls label {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
  }

  #agentchat-shell select {
    width: 100%;
    min-width: 0;
  }

  #agentchat-shell .agentchat-send {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 900px) {
  #agentchat-shell {
    inset: 64px 10px 10px;
  }

  #agentchat-shell.is-open {
    grid-template-columns: 1fr;
  }

  #agentchat-shell .agentchat-history {
    display: none;
  }
}
