#view .custom-article-chatgpt-page {
  height: calc(100dvh - 116px);
  min-height: 620px;
  padding: 16px 18px 18px;
}

#view .custom-chatgpt-shell {
  display: grid;
  grid-template-columns: minmax(260px, 288px) minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.07);
}

#view .custom-chatgpt-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border-right: 1px solid #e5e9f0;
  background: #f7f8fa;
}

#view .custom-chatgpt-side-head,
#view .custom-chatgpt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e8edf3;
}

#view .custom-chatgpt-side-head {
  min-height: 68px;
  padding: 12px 14px 12px 16px;
  background: #fff;
}

#view .custom-chatgpt-side-head > div {
  display: grid;
  gap: 2px;
}

#view .custom-chatgpt-side-head strong {
  color: #172033;
  font-size: 15px;
  font-weight: 750;
}

#view .custom-chatgpt-side-head > div > span {
  color: #8a94a3;
  font-size: 12px;
}

#view .custom-chatgpt-side-head .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  height: 34px;
  padding: 0 11px;
}

#view .custom-chatgpt-side-head .btn > span {
  margin-right: 4px;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
}

#view .custom-chatgpt-history {
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: #cbd3df transparent;
}

#view .custom-chatgpt-history-item {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 64px;
  gap: 6px;
  margin: 0 0 4px;
  padding: 10px 11px 10px 13px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #344054;
  text-align: left;
  cursor: pointer;
}

#view .custom-chatgpt-history-item::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  content: "";
}

#view .custom-chatgpt-history-item:hover {
  border-color: #e1e6ed;
  background: #fff;
}

#view .custom-chatgpt-history-item.active {
  border-color: #d4e3fb;
  background: #edf5ff;
}

#view .custom-chatgpt-history-item.active::before {
  background: #2979ff;
}

#view .custom-chatgpt-history-item strong {
  display: -webkit-box;
  overflow: hidden;
  color: #172033;
  font-size: 13px;
  font-weight: 680;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#view .custom-chatgpt-history-item > span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #8993a3;
  font-size: 11px;
  white-space: nowrap;
}

#view .custom-chatgpt-history-item > span > em {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  background: #edf1f6;
  color: #5f6b7a;
  font-style: normal;
  font-weight: 650;
}

#view .custom-chatgpt-empty-list,
#view .custom-chatgpt-default-source {
  color: #7b8797;
  font-size: 12px;
}

#view .custom-chatgpt-empty-list {
  padding: 28px 12px;
  text-align: center;
}

#view .custom-chatgpt-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: #f6f8fb;
}

#view .custom-chatgpt-header {
  min-height: 68px;
  padding: 11px 20px;
  background: #fff;
}

#view .custom-chatgpt-header > div {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

#view .custom-chatgpt-header-icon {
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #d8e5fb;
  border-radius: 7px;
  background: #eef5ff;
  color: #216cf4;
}

#view .custom-chatgpt-header-icon svg {
  width: 18px;
  height: 18px;
}

#view .custom-chatgpt-header h3 {
  margin: 0;
  color: #101828;
  font-size: 18px;
  font-weight: 760;
}

#view .custom-chatgpt-header p {
  margin: 2px 0 0;
  color: #7c8796;
  font-size: 12px;
}

#view .custom-chatgpt-header .btn {
  height: 34px;
  padding: 0 12px;
}

#view .custom-chatgpt-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 24px clamp(18px, 3vw, 40px) 28px;
  scrollbar-width: thin;
  scrollbar-color: #cbd3df transparent;
}

#view .custom-chatgpt-messages .custom-chat-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  max-width: 960px;
  margin: 0 auto 18px;
}

#view .custom-chatgpt-messages .custom-chat-message.user {
  flex-direction: row-reverse;
}

#view .custom-chatgpt-messages .custom-chat-message.has-article {
  display: block;
  margin-bottom: 24px;
}

#view .custom-chatgpt-messages .custom-chat-message.has-article .custom-chat-avatar {
  display: none;
}

#view .custom-chatgpt-messages .custom-chat-avatar {
  display: inline-flex;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #172033;
  color: #fff;
  font-size: 11px;
  font-weight: 750;
}

#view .custom-chatgpt-messages .custom-chat-message.user .custom-chat-avatar {
  background: #216cf4;
}

#view .custom-chatgpt-messages .custom-chat-bubble {
  max-width: min(760px, calc(100% - 44px));
  padding: 12px 15px;
  border: 1px solid #dfe5ec;
  border-radius: 12px;
  background: #fff;
  color: #344054;
  line-height: 1.65;
}

#view .custom-chatgpt-messages .custom-chat-message.user .custom-chat-bubble {
  border-color: #e7eaf0;
  background: #eef1f5;
  color: #172033;
}

#view .custom-chatgpt-messages .custom-chat-bubble > p {
  margin: 0;
  font-size: 13px;
}

#view .custom-chatgpt-messages .custom-chat-bubble.has-article {
  width: 100%;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#view .custom-chatgpt-messages .custom-chat-bubble.has-article > p {
  margin: 0 0 10px;
  color: #667085;
  font-size: 12px;
}

#view .custom-chat-result {
  overflow: hidden;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
}

#view .custom-chat-result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid #e8edf3;
  background: #f8fafc;
}

#view .custom-chat-result-state {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

#view .custom-chat-result-state > span {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border: 1px solid #bfe7d5;
  border-radius: 5px;
  background: #eaf8f1;
  color: #087a55;
  font-size: 12px;
  font-weight: 700;
}

#view .custom-chat-result-state > small {
  overflow: hidden;
  color: #667085;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view .custom-chat-result-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 0;
  border-top: 0;
  background: transparent;
}

#view .custom-chat-result-actions .btn {
  height: 34px;
  padding: 0 12px;
}

#view .custom-chat-result-document {
  max-width: 840px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 46px) clamp(22px, 5vw, 58px) 52px;
}

#view .custom-chat-result-head {
  display: block;
  padding: 0 0 20px;
  border-bottom: 1px solid #e7ebf0;
  background: transparent;
}

#view .custom-chat-result-head strong {
  display: block;
  color: #172033;
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 760;
  line-height: 1.35;
}

#view .custom-chat-result-head small {
  display: block;
  margin-top: 10px;
  color: #667085;
  font-size: 13px;
  line-height: 1.7;
}

#view .custom-chat-result-body {
  max-height: none;
  padding: 24px 0 0;
  overflow: visible;
}

#view .custom-chat-result-body h5 {
  margin: 22px 0 9px;
  color: #172033;
  font-size: 16px;
  font-weight: 740;
  line-height: 1.55;
}

#view .custom-chat-result-body h5:first-child {
  margin-top: 0;
}

#view .custom-chat-result-body p {
  margin: 0 0 14px;
  color: #3f4a5a;
  font-size: 14px;
  line-height: 1.9;
}

#view .custom-chatgpt-composer {
  width: 100%;
  padding: 12px clamp(18px, 3vw, 40px) 14px;
  border-top: 1px solid #e5e9f0;
  background: #fff;
}

#view .custom-chatgpt-composer > * {
  width: 100%;
  max-width: 960px;
  margin-right: auto;
  margin-left: auto;
}

#view .custom-chatgpt-settings {
  display: grid;
  grid-template-columns: minmax(220px, 1.65fr) repeat(3, minmax(116px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

#view .custom-chatgpt-setting {
  display: grid;
  min-width: 0;
  gap: 4px;
}

#view .custom-chatgpt-setting > span {
  color: #647084;
  font-size: 11px;
  font-weight: 650;
}

#view .custom-chatgpt-setting .input,
#view .custom-chatgpt-setting .select {
  width: 100%;
  height: 36px;
  min-width: 0;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  background: #fff;
}

#view .custom-chatgpt-attachments,
#view .custom-chatgpt-default-source {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 68px;
  margin-bottom: 8px;
  padding: 0 2px;
  overflow-y: auto;
}

#view .custom-chatgpt-default-source {
  min-height: 20px;
  align-items: center;
}

#view .custom-chatgpt-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  height: 30px;
  padding: 0 7px;
  border: 1px solid #dbe5f3;
  border-radius: 5px;
  background: #f5f8fc;
  color: #245ea9;
  font-size: 11px;
  font-weight: 650;
}

#view .custom-chatgpt-attachment svg {
  width: 14px;
  height: 14px;
}

#view .custom-chatgpt-attachment em {
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view .custom-chatgpt-attachment button {
  display: inline-flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

#view .custom-chatgpt-input-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 64px;
  align-items: end;
  gap: 8px;
  padding: 9px;
  border: 1px solid #bdc8d8;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(16, 24, 40, 0.07);
}

#view .custom-chatgpt-input-row:focus-within {
  border-color: #6ea4f7;
  box-shadow: 0 0 0 3px rgba(33, 108, 244, 0.1);
}

#view .custom-chatgpt-upload,
#view .custom-chatgpt-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  border: 0;
  cursor: pointer;
}

#view .custom-chatgpt-upload {
  width: 36px;
  padding: 0;
  border-radius: 7px;
  background: #eef2f7;
  color: #344054;
}

#view .custom-chatgpt-upload:hover {
  background: #e3e9f1;
}

#view .custom-chatgpt-upload svg {
  width: 18px;
  height: 18px;
}

#view .custom-chatgpt-textarea,
#view .custom-chatgpt-textarea:focus {
  min-height: 38px;
  max-height: 128px;
  padding: 8px 0 6px;
  border: 0;
  outline: 0;
  resize: none;
  box-shadow: none;
}

#view .custom-chatgpt-send {
  padding: 0 14px;
  border-radius: 7px;
  background: #172033;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

#view .custom-chatgpt-send:hover {
  background: #0b1220;
}

#view .custom-chatgpt-send:disabled {
  background: #98a2b3;
  cursor: not-allowed;
}

#view .custom-chatgpt-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

#view .custom-chatgpt-hints button {
  height: 28px;
  padding: 0 9px;
  border: 1px solid #d0d5dd;
  border-radius: 5px;
  background: #fff;
  color: #566273;
  font-size: 11px;
  cursor: pointer;
}

#view .custom-chatgpt-hints button:hover {
  border-color: #7aaafa;
  color: #216cf4;
}

#view .custom-chat-loading {
  display: inline-flex;
  gap: 4px;
  margin-top: 8px;
}

#view .custom-chat-loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #70a6f7;
  animation: customAssistantPulse 1s infinite ease-in-out;
}

#view .custom-chat-loading span:nth-child(2) {
  animation-delay: 0.15s;
}

#view .custom-chat-loading span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes customAssistantPulse {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-4px); }
}

@media (max-width: 1180px) {
  #view .custom-chatgpt-settings {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  #view .custom-article-chatgpt-page {
    height: auto;
    min-height: 0;
    padding: 12px;
  }

  #view .custom-chatgpt-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 200px minmax(720px, auto);
    height: auto;
  }

  #view .custom-chatgpt-sidebar {
    border-right: 0;
    border-bottom: 1px solid #e5e9f0;
  }

  #view .custom-chatgpt-main {
    min-height: 720px;
  }

  #view .custom-chatgpt-messages {
    min-height: 360px;
  }
}

@media (max-width: 640px) {
  #view .custom-chatgpt-header {
    padding: 10px 12px;
  }

  #view .custom-chatgpt-header p {
    display: none;
  }

  #view .custom-chatgpt-messages {
    padding: 16px 10px 20px;
  }

  #view .custom-chatgpt-settings {
    grid-template-columns: 1fr;
  }

  #view .custom-chatgpt-composer {
    padding: 10px;
  }

  #view .custom-chat-result-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  #view .custom-chat-result-state {
    justify-content: space-between;
  }

  #view .custom-chat-result-actions {
    justify-content: flex-end;
  }

  #view .custom-chat-result-document {
    padding: 24px 18px 34px;
  }

  #view .custom-chatgpt-input-row {
    grid-template-columns: 36px minmax(0, 1fr) 58px;
  }
}
