#chat-panel {
  width: min(426px, calc(100vw - 24px));
  height: min(664px, calc(100dvh - 104px));
  border-radius: 23px;
  box-shadow: 0 22px 70px #1021442b, 0 3px 14px #14284e12;
}
#chat-panel .chat-header {
  padding: 13px 16px;
  background: linear-gradient(115deg, #102344 0%, #172b51 70%, #263c67 100%);
}
#chat-panel .chat-avatar { border-radius: 12px; }
#chat-panel .chat-header button { justify-content: center; align-items: center; min-width: 34px; min-height: 36px; border-radius: 9px; }
#chat-panel .chat-header button:hover { background: #ffffff1b; }
.chat-topic-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 16px;
  border-bottom: 1px solid #e6ebf4;
  font-size: 13px;
  color: #50637e;
  background: #f5f7fc;
}
#chat-directory-toggle { display: flex; align-items: center; gap: 7px; padding: 5px 0 5px 9px; min-height: 34px; color: #254bac; font-size: 14px; font-weight: 550; }
#chat-directory-toggle i { width: 8px; height: 8px; margin: 0 2px 3px; border: solid currentColor; border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); }
#chat-directory-toggle[aria-expanded="true"] i { margin: 4px 2px 0; transform: rotate(225deg); }
#chat-panel .messages { min-height: 0; }
#chat-panel .message-content { line-height: 1.65; }
.chat-directory { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 16px 4px; background: #fafbff; }
.chat-directory label, .chat-related p { margin: 0 0 5px; font-size: 13px; font-weight: 550; color: #56657b; }
.chat-directory select { width: 100%; min-height: 40px; padding: 7px 12px; background: #fff; color: #172c50; border: 1px solid #d9e1f0; border-radius: 10px; font-size: 15px; }
#chat-topic-menu { min-height: 0; margin: 8px 0 0; padding: 0 3px 4px; overflow-y: auto; overscroll-behavior: contain; list-style: none; }
#chat-topic-menu li + li { border-top: 1px solid #e1e7f2; }
#chat-topic-menu button { display: block; width: 100%; min-height: 42px; padding: 9px 6px; border-radius: 6px; color: #233858; text-align: left; font-size: 15px; line-height: 1.45; }
#chat-topic-menu button:hover, #chat-topic-menu button:focus-visible { color: #204abe; background: #eef3ff; }
.chat-related { flex-shrink: 0; padding: 9px 14px 5px; border-top: 1px solid #e8edf5; }
.chat-related .chat-quick { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 6px; padding: 0; border: 0; }
.chat-related .chat-quick button { max-width: 100%; border-color: #d8e2f5; color: #31558e; font-size: 13px; line-height: 1.35; padding: 5px 9px; white-space: normal; text-align: left; }
#chat-panel .chat-form textarea { min-width: 0; }
#chat-panel .chat-form { padding-top: 6px; }
@media (max-height: 650px) {
  #chat-panel { height: calc(100dvh - 92px); max-height: calc(100dvh - 92px); }
  #chat-panel .chat-header { padding-block: 6px; }
  .chat-related { padding-block: 3px; }
  .chat-related p { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (max-height: 480px) {
  #chat-panel { bottom: 8px; height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
  #chat-panel .messages { padding-block: 8px; }
  #chat-panel .chat-header div > span { display: none; }
}
