body[data-view="consult"] {
  --advisor-tabs-height: calc(var(--connect-nav-height) + env(safe-area-inset-bottom) + 1px);
  overflow: hidden;
  background: #f3f7fc;
}

body[data-view="consult"] .site-header,
body[data-view="consult"] .site-footer {
  display: none;
}

body[data-view="consult"] .connect-tabs {
  top: calc(var(--advisor-viewport-top, 0px) + var(--advisor-viewport-height, 100dvh) - var(--advisor-tabs-height));
  bottom: auto;
}

.advisor {
  --advisor-header-height: 59px;
  position: fixed;
  top: var(--advisor-viewport-top, 0px);
  right: 0;
  left: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, var(--connect-page-width));
  height: calc(var(--advisor-viewport-height, 100dvh) - var(--advisor-tabs-height));
  margin: 0 auto;
  background: #fff;
  color: #152447;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
}

.advisor-header {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  min-height: calc(var(--advisor-header-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 10px 0;
  border-bottom: 1px solid #e5edf8;
  background: linear-gradient(125deg, #f0f6ff, #f8fbff 75%);
}

.advisor-header h1 {
  margin: 0;
  color: #102149;
  font-size: clamp(17px, 4.9vw, 23px);
  font-weight: 720;
  line-height: 1.25;
  text-align: center;
}

.advisor-header__action {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  padding: 2px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #354867;
  font: inherit;
  font-size: 11px;
  line-height: 1.15;
  cursor: pointer;
}

.advisor-header__action .connect-icon { font-size: 22px; }
.advisor-header__action:hover { background: #e6f0ff; color: #145ac9; }
.advisor-header__action:disabled { opacity: .65; cursor: wait; }

.advisor .advisor-messages {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 19px clamp(14px, 4.2vw, 31px) 16px;
  background: #fff;
}

.advisor-messages:focus-visible { outline: 2px solid #6698e9; outline-offset: -2px; }

.advisor-welcome {
  width: min(100%, 460px);
  margin: clamp(20px, 11dvh, 120px) auto 22px;
  text-align: center;
}

.advisor-welcome img { display: block; width: clamp(75px, 22vw, 105px); height: auto; margin: 0 auto 12px; }
.advisor-welcome h2 { margin: 0; color: #13264e; font-size: clamp(20px, 5.3vw, 27px); line-height: 1.35; }
.advisor-welcome p { margin: 6px 0 17px; color: #536480; font-size: 14px; }

.advisor-starters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.advisor-starters button {
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid #deebff;
  border-radius: 999px;
  background: #edf5ff;
  color: #1b427c;
  font-size: 13px;
  cursor: pointer;
}

.advisor-starters button:hover { background: #e1eeff; }

.advisor .message { margin: 0 0 16px; }
.advisor .message:last-child { margin-bottom: 0; }
.advisor .message.user { justify-content: flex-end; margin-bottom: 20px; }
.advisor .message.user .bubble {
  max-width: min(91%, 550px);
  padding: 10px 14px;
  border-radius: 19px;
  background: #e5f0ff;
  color: #13294e;
  font-size: clamp(15px, 3.8vw, 17px);
  line-height: 1.55;
}

.advisor .message.bot {
  display: grid;
  justify-items: start;
  gap: 10px;
  width: min(100%, 690px);
  min-width: 0;
}

.advisor-author {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: #13264e;
  font-size: 15px;
  font-weight: 700;
}

.advisor-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #edf5ff;
}

.advisor-avatar img { display: block; width: 29px; height: auto; }

.advisor .bot .bubble {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #17233d;
  font-size: clamp(15px, 3.88vw, 17px);
  line-height: 1.66;
  overflow-wrap: anywhere;
}

.advisor .bot .bubble.is-formatted { white-space: normal; }
.advisor .bot .bubble h3 { margin: 10px 0 5px; font-size: 1.02em; }
.advisor .bot .bubble p { margin: 0 0 12px; }
.advisor .bot .bubble p:last-child { margin-bottom: 0; }
.advisor .bot .bubble :is(ol, ul) { margin: 8px 0 12px; padding-inline-start: 1.45em; }
.advisor .bot .bubble li { margin: 8px 0; }

.advisor .bot .bubble hr {
  margin: 22px 0;
  border: 0;
  border-top: 1px solid #dce6f3;
}

.advisor-table {
  max-width: 100%;
  margin: 14px 0;
  overflow-x: auto;
  border: 1px solid #dce6f3;
  border-radius: 8px;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #8aa5c8 #f1f6fd;
}

.advisor-table:focus-visible { outline: 2px solid #135bc7; outline-offset: 2px; }
.advisor-table table { width: 100%; border-collapse: collapse; font-size: .94em; }
.advisor-table :is(th, td) {
  min-width: 7.5rem;
  max-width: 22rem;
  padding: 10px 12px;
  border-bottom: 1px solid #dce6f3;
  text-align: start;
  vertical-align: top;
  overflow-wrap: break-word;
  font-variant-numeric: tabular-nums;
}
.advisor-table th { background: #f1f6fd; color: #13264e; font-weight: 600; }
.advisor-table tr:last-child td { border-bottom: 0; }
.advisor-table .align-center { text-align: center; }
.advisor-table .align-right { text-align: right; }

.advisor-copy {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 5px;
  padding: 2px 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #516382;
  font-size: 13px;
  cursor: pointer;
}

.advisor-copy .connect-icon { font-size: 16px; }
.advisor-copy:hover { color: #135bc7; background: #f1f6fd; }

.advisor .advisor-history {
  inset: calc(var(--advisor-header-height) + env(safe-area-inset-top)) auto 0 0;
  z-index: 5;
  width: min(100%, 360px);
  max-height: none;
  border-right: 1px solid #e5edf8;
  border-radius: 0 0 16px 0;
  box-shadow: 6px 5px 20px #122f5f16;
}

.advisor-composer {
  min-width: 0;
  margin: 0;
  padding: 7px clamp(11px, 3.4vw, 27px) 8px;
  border-top: 1px solid #f0f3f9;
  background: #fff;
}

.advisor-disclaimer {
  margin: 6px 4px 0;
  color: #536480;
  font-size: 10.5px;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
}

.advisor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 5px 9px;
  margin: 0 0 7px;
}

.advisor-modes {
  display: inline-flex;
  flex: none;
  gap: 1px;
  padding: 2px;
  border-radius: 12px;
  background: #edf1f7;
}

.advisor-modes button {
  display: inline-flex;
  min-height: 31px;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #435676;
  font-size: 13px;
  font-weight: 620;
  line-height: 1.2;
  cursor: pointer;
}

.advisor-modes .connect-icon { font-size: 15px; }
.advisor-modes button[aria-pressed="true"] { border-color: #a9c9ff; background: #e4f0ff; color: #0b59d4; }
.advisor-modes button:disabled { cursor: default; }

.advisor-connection {
  display: flex;
  max-width: 100%;
  align-items: center;
  gap: 4px;
  color: #526480;
  font-size: 11px;
  line-height: 1.3;
}

.advisor-connection button {
  flex: none;
  padding: 1px 3px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #0b58c9;
  font: inherit;
  cursor: pointer;
}

.advisor-entry {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  gap: 5px;
  padding: 3px 4px 3px 12px;
  border: 1px solid #dfe7f4;
  border-radius: 22px;
  background: #fafcfe;
}
.advisor-entry:focus-within { border-color: #86b2f7; }

.advisor-entry textarea {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  max-height: 102px;
  resize: none;
  field-sizing: content;
  margin: 0;
  padding: 9px 0 8px;
  border: 0;
  background: transparent;
  color: #152447;
  font-size: 16px;
  line-height: 1.45;
  outline: none;
  box-shadow: none;
}
.advisor-entry textarea::placeholder { color: #65738a; opacity: 1; }

.advisor-entry button {
  display: grid;
  flex: none;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #1464f5;
  color: #fff;
  font-size: 23px;
  cursor: pointer;
}

.advisor-entry button:not(.is-stop) .connect-icon { transform: rotate(-38deg); }
.advisor-entry button:hover:not(:disabled) { background: #0b52da; }
.advisor-entry button:disabled { background: #cad6e9; color: #405575; cursor: default; }

@media (max-height: 540px) {
  .advisor-welcome { margin-top: 13px; }
  .advisor-welcome img { width: 58px; margin-bottom: 5px; }
}
