:root {
  --guest-page: #f7f8fb;
  --guest-surface: rgba(255, 255, 255, 0.92);
  --guest-surface-strong: #ffffff;
  --guest-ink: #111827;
  --guest-muted: #697386;
  --guest-line: rgba(31, 45, 73, 0.12);
  --guest-accent: #5751df;
  --guest-accent-2: #7652dd;
  --guest-shadow: 0 18px 56px rgba(29, 39, 73, 0.1);
}

html[data-theme="dark"] {
  --guest-page: #080e18;
  --guest-surface: rgba(14, 23, 37, 0.9);
  --guest-surface-strong: #101a2a;
  --guest-ink: #f5f7fb;
  --guest-muted: #9aa8bd;
  --guest-line: rgba(146, 167, 203, 0.16);
  --guest-accent: #6e7cf4;
  --guest-accent-2: #9b6df0;
  --guest-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

.login-close-button {
  display: none;
}

/* The legacy shell hides the application whenever there is no authenticated
   account. Guest chat is intentionally an unauthenticated application mode,
   so make the hidden-state contract explicit and override that legacy rule. */
body.guest-mode:not(.login-open) .login-screen,
body.guest-mode:not(.login-open) .password-change-screen {
  display: none !important;
}

body.guest-mode .app-shell {
  display: block !important;
  position: relative;
  z-index: 0;
}

body.guest-mode.login-open .app-shell {
  pointer-events: none;
  visibility: hidden !important;
}

body.guest-mode.login-open > .theme-switch-floating {
  visibility: hidden !important;
}

body.session-loading .login-screen,
body.session-loading .app-shell {
  visibility: hidden;
}

/* Preserve the signed-in drawer's former field geometry after changing the
   shared question control from a one-line input to an auto-growing textarea. */
#ask.assistant-drawer .ask-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 168px;
  resize: none;
  overflow-y: auto;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--input-bg, var(--panel));
  font: inherit;
  line-height: 1.5;
}

body.guest-mode {
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  color: var(--guest-ink);
  background: var(--guest-page);
}

body.guest-mode .theme-switch-floating,
body.guest-mode .sidebar,
body.guest-mode .topbar,
body.guest-mode .workspace > .view:not(#ask),
body.guest-mode #askLauncher {
  display: none !important;
}

body.guest-mode .app-shell,
body.guest-mode .workspace {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  overflow: hidden;
}

body.guest-mode #ask.assistant-drawer {
  position: fixed;
  inset: 0;
  z-index: 3400;
  width: 100%;
  height: 100vh;
  height: var(--assistant-layout-height, 100svh);
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: var(--guest-ink);
  background:
    radial-gradient(circle at 50% 10%, color-mix(in srgb, var(--guest-accent) 7%, transparent), transparent 34%),
    var(--guest-page);
  box-shadow: none;
  opacity: 1;
  visibility: visible;
  transform: none;
  animation: none;
}

body.guest-mode #ask.assistant-drawer .guest-chat-header {
  position: relative;
  z-index: 30;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px clamp(18px, 3vw, 46px);
  border-bottom: 1px solid var(--guest-line);
  background: color-mix(in srgb, var(--guest-surface) 88%, transparent);
  backdrop-filter: blur(18px);
}

.guest-chat-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--guest-ink);
  text-decoration: none;
}

.guest-chat-brand .brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}

.guest-chat-brand > span:last-child,
.guest-chat-brand strong,
.guest-chat-brand small {
  display: block;
}

.guest-chat-brand strong {
  font-size: 15px;
  line-height: 1.2;
}

.guest-language-button,
.login-language-button,
.guest-theme-button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--guest-line);
  border-radius: 12px;
  color: var(--guest-muted);
  background: color-mix(in srgb, var(--guest-surface-strong) 88%, transparent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease, background .18s ease, transform .18s ease;
}

.guest-language-button:hover,
.login-language-button:hover,
.guest-theme-button:hover {
  border-color: color-mix(in srgb, var(--guest-accent) 42%, var(--guest-line));
  color: var(--guest-ink);
  background: color-mix(in srgb, var(--guest-accent) 8%, var(--guest-surface-strong));
  transform: translateY(-1px);
}

.login-language-button {
  position: fixed;
  z-index: 2147483647;
  top: clamp(16px, 3vw, 28px);
  right: clamp(16px, 3vw, 28px);
}

.guest-chat-brand small {
  margin-top: 2px;
  color: var(--guest-muted);
  font-size: 11px;
  line-height: 1.2;
}

.guest-chat-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.guest-auth-cluster[hidden],
.guest-auth-signed-in[hidden] {
  display: none !important;
}

.guest-auth-cluster {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--guest-accent) 14%, var(--guest-line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--guest-surface-strong) 94%, transparent);
  box-shadow: 0 12px 34px rgba(41, 58, 118, 0.1);
}

.guest-auth-cluster .guest-language-button {
  width: auto;
  height: 38px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: var(--guest-muted);
  background: transparent;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.guest-auth-cluster .guest-language-button svg {
  width: 18px;
  height: 18px;
  color: var(--guest-accent);
}

.guest-auth-cluster .guest-language-button:hover {
  border-color: transparent;
  background: color-mix(in srgb, var(--guest-accent) 7%, transparent);
}

.guest-auth-divider {
  width: 1px;
  height: 24px;
  margin: 0 7px 0 5px;
  flex: 0 0 1px;
  background: var(--guest-line);
}

.guest-auth-cluster .guest-login-button,
.guest-workbench-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(115deg, #20b9f8 0%, #4454f5 48%, #7a51e8 100%);
  box-shadow: 0 10px 24px rgba(83, 78, 226, 0.26);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.guest-auth-cluster .guest-login-button {
  letter-spacing: 0.12em;
}

.guest-auth-cluster .guest-login-button:hover,
.guest-workbench-button:hover {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(115deg, #20b9f8 0%, #4454f5 48%, #7a51e8 100%);
  box-shadow: 0 13px 30px rgba(83, 78, 226, 0.32);
  filter: saturate(1.08);
  transform: translateY(-1px);
}

.guest-auth-signed-in {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.guest-user-pill {
  min-width: 0;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 5px 6px;
  border: 1px solid color-mix(in srgb, var(--guest-accent) 14%, var(--guest-line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--guest-surface-strong) 94%, transparent);
  box-shadow: 0 12px 34px rgba(41, 58, 118, 0.1);
}

.guest-user-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, var(--guest-accent), var(--guest-accent-2));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--guest-accent) 26%, transparent);
  font-size: 13px;
  font-weight: 850;
}

.guest-user-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
  line-height: 1.1;
}

.guest-user-copy strong {
  max-width: 132px;
  overflow: hidden;
  color: var(--guest-ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guest-user-copy small {
  color: var(--guest-muted);
  font-size: 10px;
}

.guest-workbench-button {
  min-height: 48px;
  padding: 0 18px;
}

.guest-workbench-button svg {
  width: 17px;
  height: 17px;
}

.guest-quota-badge {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border: 1px solid color-mix(in srgb, var(--guest-accent) 22%, var(--guest-line));
  border-radius: 999px;
  color: color-mix(in srgb, var(--guest-accent) 78%, var(--guest-ink));
  background: color-mix(in srgb, var(--guest-accent) 8%, var(--guest-surface-strong));
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.guest-theme-button,
.guest-login-button {
  min-height: 40px;
  border: 1px solid var(--guest-line);
  color: var(--guest-ink);
  background: var(--guest-surface);
}

.guest-theme-button {
  width: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 12px;
}

.guest-theme-button svg {
  width: 17px;
  height: 17px;
}

html[data-theme="dark"] .guest-theme-button .theme-switch-moon,
html[data-theme="light"] .guest-theme-button .theme-switch-sun {
  display: none;
}

.guest-login-button {
  gap: 8px;
  padding: 0 15px;
  border-radius: 12px;
  font-size: 13px;
}

.guest-login-button:hover,
.guest-theme-button:hover {
  border-color: color-mix(in srgb, var(--guest-accent) 40%, var(--guest-line));
  background: color-mix(in srgb, var(--guest-accent) 7%, var(--guest-surface-strong));
}

body.guest-mode #ask.assistant-drawer .ask-layout {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  overflow: hidden;
}

body.guest-mode #ask.assistant-drawer .ask-panel {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: var(--guest-ink);
  background: transparent;
  box-shadow: none;
}

body.guest-mode #ask .assistant-drawer-heading,
body.guest-mode #ask .source-panel {
  display: none !important;
}

body.guest-mode .guest-chat-welcome {
  position: absolute;
  top: 45%;
  left: 50%;
  z-index: 4;
  width: min(760px, calc(100% - 36px));
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  transform: translate(-50%, -50%);
}

body.guest-mode.guest-chat-started .guest-chat-welcome {
  display: none;
}

.guest-welcome-avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(145deg, var(--guest-accent), var(--guest-accent-2));
  box-shadow: 0 14px 30px color-mix(in srgb, var(--guest-accent) 24%, transparent);
  font-size: 21px;
  font-weight: 800;
}

.guest-welcome-logo {
  position: relative;
  width: 144px;
  height: 144px;
  display: grid;
  place-items: center;
  margin-bottom: -4px;
  transform: translateY(-8px);
  filter: drop-shadow(0 16px 30px color-mix(in srgb, var(--guest-accent) 18%, transparent));
}

.guest-welcome-logo svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.guest-welcome-logo .eo-orbit {
  transform-box: view-box;
  transform-origin: 74.3px 74.3px;
  will-change: opacity, transform;
}

body.guest-mode:not(.guest-chat-started) .guest-welcome-logo .eo-orbit-1,
body.guest-mode:not(.guest-chat-started) .guest-welcome-logo .eo-orbit-3,
body.guest-mode:not(.guest-chat-started) .guest-welcome-logo .eo-orbit-5 {
  animation: eo-ring-clockwise var(--eo-orbit-speed, 4.8s) linear infinite;
}

body.guest-mode:not(.guest-chat-started) .guest-welcome-logo .eo-orbit-2,
body.guest-mode:not(.guest-chat-started) .guest-welcome-logo .eo-orbit-4 {
  animation: eo-ring-counter-clockwise var(--eo-orbit-speed, 4.2s) linear infinite;
}

.guest-welcome-logo .eo-orbit-1 { --eo-orbit-speed: 7.2s; }
.guest-welcome-logo .eo-orbit-2 { --eo-orbit-speed: 6.1s; }
.guest-welcome-logo .eo-orbit-3 { --eo-orbit-speed: 5.2s; }
.guest-welcome-logo .eo-orbit-4 { --eo-orbit-speed: 4.4s; }
.guest-welcome-logo .eo-orbit-5 { --eo-orbit-speed: 3.7s; }

@keyframes eo-ring-clockwise {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes eo-ring-counter-clockwise {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

.guest-chat-welcome .eyebrow {
  margin: 4px 0 0;
  color: color-mix(in srgb, var(--guest-accent) 72%, var(--guest-muted));
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.guest-chat-welcome h1 {
  margin: 0;
  color: var(--guest-ink);
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.2;
}

.guest-chat-welcome > p:not(.eyebrow) {
  max-width: 580px;
  margin: 0;
  color: var(--guest-muted);
  font-size: 15px;
  line-height: 1.7;
}

.guest-quick-prompts {
  width: min(700px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.guest-quick-prompts button {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 15px;
  overflow: hidden;
  border: 1px solid var(--guest-line);
  border-radius: 16px;
  color: var(--guest-ink);
  background: var(--guest-surface);
  box-shadow: 0 8px 26px rgba(31, 45, 73, 0.04);
  text-align: left;
}

.guest-quick-prompts button:hover {
  border-color: color-mix(in srgb, var(--guest-accent) 38%, var(--guest-line));
  background: color-mix(in srgb, var(--guest-accent) 5%, var(--guest-surface-strong));
  transform: translateY(-1px);
}

.guest-quick-prompts svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--guest-accent);
}

body.guest-mode #ask.assistant-drawer .chat-window {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  display: grid;
  align-content: start;
  gap: 22px;
  margin: 0;
  padding: 34px max(18px, calc((100% - 880px) / 2)) 28px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 0;
  color: var(--guest-ink);
  background: transparent;
  scrollbar-gutter: stable;
}

body.guest-mode:not(.guest-chat-started) #ask .chat-window {
  visibility: hidden;
}

body.guest-mode #ask .message {
  width: auto;
  max-width: min(760px, 88%);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--guest-ink);
  background: transparent;
  box-shadow: none;
  font-size: 15px;
  line-height: 1.78;
}

body.guest-mode #ask .message.user {
  justify-self: end;
  padding: 11px 16px;
  border-radius: 18px 18px 5px 18px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--guest-accent), var(--guest-accent-2));
}

body.guest-mode #ask .message.assistant {
  justify-self: start;
}

body.guest-mode #ask .message.assistant::before {
  content: "亿";
  width: 30px;
  height: 30px;
  float: left;
  display: grid;
  place-items: center;
  margin: 2px 12px 5px 0;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, var(--guest-accent), var(--guest-accent-2));
  font-size: 12px;
  font-weight: 800;
}

body.guest-mode #ask .assistant-identity {
  display: none;
}

body.guest-mode #ask .message-meta,
body.guest-mode #ask .source-card,
body.guest-mode #ask .official-answer-link {
  color: var(--guest-muted);
}

body.guest-mode #ask .ask-loading-message {
  width: min(640px, 90%);
  padding: 14px 16px;
  border: 1px solid var(--guest-line);
  border-radius: 16px;
  background: var(--guest-surface);
}

body.guest-mode #ask.assistant-drawer .ask-form {
  position: relative;
  z-index: 20;
  width: min(880px, calc(100% - 36px));
  min-height: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 0 auto max(14px, env(safe-area-inset-bottom));
  padding: 7px 8px 7px 16px;
  border: 1px solid color-mix(in srgb, var(--guest-accent) 18%, var(--guest-line));
  border-radius: 20px;
  color: var(--guest-ink);
  background: var(--guest-surface-strong);
  box-shadow: var(--guest-shadow);
  backdrop-filter: blur(18px);
}

body.guest-mode #ask .ask-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  max-height: 168px;
  resize: none;
  overflow-y: auto;
  padding: 9px 0;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  appearance: none;
  box-shadow: none !important;
  color: var(--guest-ink);
  background: transparent;
  font-size: 15px;
  line-height: 24px;
}

body.guest-mode #ask .ask-form textarea::placeholder {
  color: var(--guest-muted);
}

body.guest-mode #ask .ask-form > .primary-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--guest-accent), var(--guest-accent-2));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--guest-accent) 24%, transparent);
}

body.guest-mode #ask .ask-form > .primary-button span {
  display: none;
}

body.guest-mode #ask .guest-quota-hint {
  display: none !important;
}

body.guest-mode.guest-quota-exhausted #ask .ask-form {
  border-color: rgba(220, 113, 64, 0.28);
}

body.guest-mode .login-screen {
  display: none;
}

@media (min-width: 781px) {
  body.guest-mode:not(.guest-chat-started) #ask.assistant-drawer .ask-panel {
    grid-template-rows: auto;
    grid-auto-rows: auto;
    align-content: center;
    justify-items: center;
    row-gap: 8px;
    padding-top: clamp(34px, 7vh, 86px);
  }

  body.guest-mode:not(.guest-chat-started) .guest-chat-welcome {
    position: static;
    width: auto;
    display: contents;
    text-align: center;
    transform: none;
  }

  body.guest-mode:not(.guest-chat-started) .guest-welcome-logo {
    order: 1;
  }

  body.guest-mode:not(.guest-chat-started) .guest-chat-welcome .eyebrow {
    order: 2;
  }

  body.guest-mode:not(.guest-chat-started) .guest-chat-welcome h1 {
    order: 3;
  }

  body.guest-mode:not(.guest-chat-started) .guest-chat-welcome > p:not(.eyebrow) {
    order: 4;
  }

  body.guest-mode:not(.guest-chat-started) #ask.assistant-drawer .ask-form {
    order: 5;
    width: min(820px, calc(100% - 48px));
    min-height: 60px;
    margin: 18px auto 0;
    padding: 7px 8px 7px 20px;
    border-radius: 999px;
  }

  body.guest-mode:not(.guest-chat-started) #ask .ask-form > .primary-button {
    width: 46px;
    min-width: 46px;
    height: 46px;
    min-height: 46px;
    border-radius: 50%;
  }

  body.guest-mode:not(.guest-chat-started) .guest-quick-prompts {
    order: 6;
    width: min(540px, calc(100% - 48px));
    gap: 9px;
    margin-top: 15px;
  }

  body.guest-mode:not(.guest-chat-started) .guest-quick-prompts button {
    min-height: 46px;
    gap: 9px;
    padding: 8px 14px;
    border-radius: 14px;
    font-size: 14px;
  }

  body.guest-mode:not(.guest-chat-started) .guest-quick-prompts svg {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
  }

  body.guest-mode:not(.guest-chat-started) #ask.assistant-drawer .chat-window {
    display: none;
  }
}

body.guest-mode.login-open .login-screen {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  min-height: 100%;
  display: grid !important;
  place-items: center;
  padding: 22px;
  background: rgba(9, 14, 25, 0.52);
  backdrop-filter: blur(14px);
  isolation: isolate;
  pointer-events: auto;
}

body.guest-mode.login-open .login-card {
  position: relative;
  width: min(430px, 100%);
  padding: 28px;
  border: 1px solid var(--guest-line);
  border-radius: 22px;
  color: var(--guest-ink);
  background: var(--guest-surface-strong);
  box-shadow: 0 28px 90px rgba(5, 10, 22, 0.3);
}

body.guest-mode.login-open .login-card h1,
body.guest-mode.login-open .login-brand,
body.guest-mode.login-open .login-form input {
  color: var(--guest-ink);
}

body.guest-mode.login-open .login-card p,
body.guest-mode.login-open .login-brand span,
body.guest-mode.login-open .login-form label span,
body.guest-mode.login-open .login-form small {
  color: var(--guest-muted);
}

body.guest-mode.login-open .login-form input {
  border-color: var(--guest-line);
  background: color-mix(in srgb, var(--guest-page) 70%, var(--guest-surface-strong));
}

body.guest-mode.login-open .login-close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  place-items: center;
  border-color: var(--guest-line);
  color: var(--guest-ink);
  background: transparent;
}

body.guest-mode button,
body.guest-mode textarea,
body.guest-mode input {
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, opacity 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

body.guest-mode button:focus-visible,
body.guest-mode textarea:focus-visible,
body.guest-mode input:focus-visible,
body.guest-mode a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--guest-accent) 70%, #ffffff);
  outline-offset: 2px;
}

@media (max-width: 780px) {
  body.guest-mode #ask.assistant-drawer {
    height: var(--assistant-layout-height, 100svh);
    max-height: var(--assistant-layout-height, 100svh);
  }

  body.guest-mode #ask.assistant-drawer .guest-chat-header {
    min-height: 60px;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  }

  .guest-chat-brand .brand-mark {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .guest-chat-brand small,
  .guest-quota-badge {
    display: none;
  }

  .guest-chat-actions {
    gap: 7px;
  }

  .guest-auth-cluster {
    min-height: 42px;
    padding: 4px;
  }

  .guest-auth-cluster .guest-language-button {
    height: 34px;
    padding: 0 10px;
  }

  .guest-auth-cluster .guest-login-button {
    min-height: 34px;
    padding: 0 16px;
  }

  .guest-auth-divider {
    height: 20px;
    margin: 0 5px 0 3px;
  }

  .guest-auth-signed-in {
    gap: 6px;
  }

  .guest-user-pill {
    min-height: 42px;
    padding: 4px 10px 4px 4px;
  }

  .guest-user-avatar {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .guest-user-copy small {
    display: none;
  }

  .guest-workbench-button {
    min-height: 42px;
    padding: 0 14px;
  }

  .guest-theme-button,
  .guest-login-button {
    min-height: 40px;
  }

  .guest-login-button {
    padding: 0 12px;
  }

  body.guest-mode .guest-chat-welcome {
    top: 43%;
    width: calc(100% - 28px);
  }

  .guest-chat-welcome > p:not(.eyebrow) {
    font-size: 14px;
  }

  .guest-welcome-logo {
    width: 112px;
    height: 112px;
    transform: translateY(-5px);
  }

  .guest-quick-prompts {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
  }

  .guest-quick-prompts button {
    min-height: 48px;
    border-radius: 14px;
  }

  body.guest-mode #ask.assistant-drawer .chat-window {
    gap: 18px;
    padding: 22px 16px 18px;
    -webkit-overflow-scrolling: touch;
  }

  body.guest-mode #ask .message {
    max-width: 94%;
    font-size: 14px;
    line-height: 1.72;
  }

  body.guest-mode #ask.assistant-drawer .ask-form {
    position: sticky;
    inset: auto 0 0;
    width: calc(100% - 24px);
    margin-bottom: max(10px, env(safe-area-inset-bottom));
    padding: 8px 8px 8px 14px;
    border-radius: 20px;
    transform: translate3d(0, calc(-1 * var(--assistant-keyboard-offset, 0px)), 0);
    will-change: transform;
  }

  body.guest-mode #ask .guest-quota-hint {
    display: none;
  }

  body.guest-mode.login-open .login-card {
    padding: 24px 20px;
  }
}

@media (max-width: 480px) {
  .guest-chat-brand strong {
    font-size: 14px;
  }

  .guest-chat-brand > span:last-child,
  .guest-user-copy {
    display: none;
  }

  .guest-user-pill {
    padding: 4px;
  }

  .guest-workbench-button {
    padding: 0 13px;
  }

  .guest-chat-welcome .eyebrow {
    display: none;
  }

  .guest-chat-welcome h1 {
    font-size: 27px;
  }
}

/* Signed-in command bar: workbench first, language and account share one
   cohesive surface. Accounts without member directory fields remain active. */
.guest-chat-actions.is-signed-in > .guest-theme-button {
  display: none;
}

.guest-auth-signed-in {
  gap: 16px;
}

.guest-session-cluster {
  min-width: 0;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--guest-accent) 14%, var(--guest-line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--guest-surface-strong) 96%, transparent);
  box-shadow: 0 14px 38px rgba(41, 58, 118, 0.12), inset 0 1px rgba(255, 255, 255, 0.44);
}

.guest-session-cluster .guest-language-button-signed-in {
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.guest-language-chevron {
  width: 14px !important;
  height: 14px !important;
  color: var(--guest-muted) !important;
}

.guest-session-divider {
  width: 1px;
  height: 28px;
  flex: 0 0 1px;
  margin: 0 7px 0 3px;
  background: var(--guest-line);
}

.guest-session-cluster .guest-user-pill {
  min-height: 44px;
  padding: 4px 12px 4px 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.guest-session-cluster .guest-user-pill:hover,
.guest-session-cluster .guest-profile-menu.open .guest-user-pill {
  border-color: transparent;
  background: color-mix(in srgb, var(--guest-accent) 7%, transparent);
  box-shadow: none;
  transform: none;
}

.guest-session-cluster .guest-user-copy strong {
  max-width: 180px;
}

.guest-auth-signed-in > .guest-workbench-button {
  min-height: 52px;
  padding-inline: 20px;
  font-size: 14px;
}

.guest-account-popover[hidden] {
  display: none !important;
}

.guest-account-popover {
  width: 260px;
  position: absolute;
  z-index: 120;
  top: calc(100% + 12px);
  right: 0;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--guest-accent) 18%, var(--guest-line));
  border-radius: 17px;
  color: var(--guest-ink);
  background: color-mix(in srgb, var(--guest-surface-strong) 98%, transparent);
  box-shadow: 0 24px 64px rgba(34, 47, 96, 0.2);
  backdrop-filter: blur(22px);
  transform-origin: top right;
  animation: member-profile-in .16s cubic-bezier(.22, .8, .24, 1);
}

.guest-account-popover header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 9px 13px;
  border-bottom: 1px solid var(--guest-line);
}

.guest-account-popover header > span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.guest-account-popover header strong,
.guest-account-popover header small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guest-account-popover header strong {
  font-size: 14px;
}

.guest-account-popover header small {
  color: var(--guest-muted);
  font-size: 11px;
}

.guest-account-popover-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--guest-accent), var(--guest-accent-2));
  box-shadow: 0 7px 18px color-mix(in srgb, var(--guest-accent) 24%, transparent);
  font-size: 14px;
  font-weight: 850;
}

.guest-account-popover button {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin-top: 5px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  color: var(--guest-ink);
  background: transparent;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: color .16s ease, background-color .16s ease;
}

.guest-account-popover button:hover {
  background: color-mix(in srgb, var(--guest-accent) 7%, transparent);
}

.guest-account-popover button.danger {
  color: #d94a61;
}

.guest-account-popover button svg {
  width: 17px;
  height: 17px;
}

@media (max-width: 760px) {
  .guest-auth-signed-in {
    gap: 7px;
  }

  .guest-session-cluster {
    min-height: 44px;
    padding: 3px;
  }

  .guest-session-cluster .guest-language-button-signed-in,
  .guest-session-cluster .guest-user-pill {
    min-height: 38px;
    height: 38px;
  }

  .guest-session-divider {
    height: 22px;
    margin-inline: 3px;
  }

  .guest-auth-signed-in > .guest-workbench-button {
    min-height: 44px;
    padding-inline: 14px;
    font-size: 13px;
  }
}

@media (max-width: 540px) {
  .guest-language-chevron,
  .guest-session-cluster .guest-user-copy {
    display: none;
  }

  .guest-session-cluster .guest-language-button-signed-in {
    padding-inline: 9px;
  }

  .guest-session-cluster .guest-user-pill {
    padding: 3px;
  }

  .guest-session-divider {
    margin-inline: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.guest-mode *,
  body.guest-mode *::before,
  body.guest-mode *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Scoped visitor-chat corrections: signed-in language entry and compact composer. */
.guest-auth-signed-in .guest-language-button-signed-in {
  width: auto;
  height: 48px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--guest-muted);
  background: color-mix(in srgb, var(--guest-surface-strong) 94%, transparent);
  box-shadow: 0 12px 34px rgba(41, 58, 118, 0.1);
  letter-spacing: 0.08em;
}

.guest-auth-signed-in .guest-language-button-signed-in svg {
  width: 18px;
  height: 18px;
  color: var(--guest-accent);
}

body.guest-mode #ask.assistant-drawer .ask-form {
  border-radius: 999px;
}

body.guest-mode #ask.assistant-drawer .ask-form:focus-within {
  border-color: color-mix(in srgb, var(--guest-accent) 34%, var(--guest-line));
  box-shadow: 0 12px 30px rgba(69, 75, 164, 0.1),
    0 0 0 2px color-mix(in srgb, var(--guest-accent) 7%, transparent);
}

body.guest-mode #ask .ask-form textarea,
body.guest-mode #ask .ask-form textarea:focus,
body.guest-mode #ask .ask-form textarea:focus-visible {
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

body.guest-mode #ask .ask-form textarea::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body.guest-mode #ask .ask-form > .primary-button {
  border-radius: 50%;
}

@media (max-width: 760px) {
  .guest-auth-signed-in .guest-language-button-signed-in {
    height: 42px;
    padding: 0 10px;
  }
}

/* Member profile popover — production merge 2026-08-31 */
.guest-profile-menu {
  position: relative;
  min-width: 0;
}

.guest-user-pill {
  color: var(--guest-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.guest-user-pill:hover,
.guest-profile-menu.open .guest-user-pill {
  border-color: color-mix(in srgb, var(--guest-accent) 42%, var(--guest-line));
  box-shadow: 0 14px 38px rgba(41, 58, 118, 0.16);
}

.guest-user-pill.is-static {
  cursor: default;
}

.guest-user-pill.is-static:hover {
  border-color: var(--guest-line);
  box-shadow: none;
  transform: none;
}

.guest-user-pill.is-static .guest-profile-chevron {
  display: none;
}

.guest-user-pill:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--guest-accent) 25%, transparent);
  outline-offset: 2px;
}

.guest-profile-chevron {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--guest-muted);
  transition: transform .18s ease;
}

.guest-profile-menu.open .guest-profile-chevron {
  transform: rotate(180deg);
}

.member-profile-popover[hidden],
.guest-workbench-button[hidden] {
  display: none !important;
}

.member-profile-popover {
  position: absolute;
  z-index: 120;
  top: calc(100% + 12px);
  right: 0;
  width: min(430px, calc(100vw - 28px));
  max-height: min(680px, calc(100vh - 92px));
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--guest-accent) 18%, var(--guest-line));
  border-radius: 20px;
  color: var(--guest-ink);
  background: var(--guest-surface-strong);
  box-shadow: 0 26px 70px rgba(26, 33, 77, 0.24), 0 4px 18px rgba(26, 33, 77, 0.1);
  text-align: left;
  animation: member-profile-enter .18s ease-out;
}

.member-profile-popover::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, #3b4297 0 24%, #e62e67 24% 44%, #ee8268 44% 62%, #f0d133 62% 80%, #1ca686 80%);
}

@keyframes member-profile-enter {
  from { opacity: 0; transform: translateY(-6px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.member-profile-hero {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 24px 22px 18px;
  background: color-mix(in srgb, var(--guest-accent) 5%, var(--guest-surface-strong));
}

.member-profile-avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .58);
  border-radius: 18px;
  color: #fff;
  background: #30398f;
  box-shadow: 0 10px 24px rgba(48, 57, 143, .22);
  font-size: 20px;
  font-weight: 900;
}

.member-profile-hero > div { min-width: 0; }

.member-profile-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--guest-muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .16em;
}

.member-profile-hero h2,
.member-profile-hero p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-profile-hero h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.member-profile-hero p {
  margin: 4px 0 0;
  color: var(--guest-muted);
  font-size: 12px;
}

.member-profile-role {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, #1ca686 35%, var(--guest-line));
  border-radius: 999px;
  color: color-mix(in srgb, #1ca686 80%, var(--guest-ink));
  background: color-mix(in srgb, #1ca686 8%, var(--guest-surface-strong));
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.member-profile-identity-line {
  min-height: 44px;
  margin: 0 22px;
  padding: 0 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--guest-line);
  color: var(--guest-muted);
  font-size: 11px;
}

.member-profile-identity-line span,
.member-profile-grid dt,
.member-profile-footer p,
.member-profile-action {
  display: flex;
  align-items: center;
  gap: 6px;
}

.member-profile-identity-line svg,
.member-profile-grid svg,
.member-profile-footer svg {
  width: 14px;
  height: 14px;
}

.member-profile-identity-line strong {
  overflow-wrap: anywhere;
  color: var(--guest-ink);
  font-size: 12px;
}

.member-profile-forum {
  margin: 16px 22px 18px;
  display: grid;
  grid-template-columns: .7fr 1.3fr;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, #e62e67 18%, var(--guest-line));
  border-radius: 14px;
  background: color-mix(in srgb, #e62e67 4%, var(--guest-surface-strong));
}

.member-profile-forum[hidden],
.user-form [data-member-profile-field][hidden],
.user-form [data-forum-profile-field][hidden] {
  display: none;
}

.member-profile-forum > div {
  min-width: 0;
  padding: 13px 15px;
  display: grid;
  gap: 5px;
}

.member-profile-forum > div + div {
  border-left: 1px solid color-mix(in srgb, #e62e67 15%, var(--guest-line));
}

.member-profile-forum span {
  color: color-mix(in srgb, #e62e67 76%, var(--guest-muted));
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .11em;
}

.member-profile-forum strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-profile-section-heading {
  margin: 0 22px 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.member-profile-section-heading strong { font-size: 13px; }
.member-profile-section-heading span { color: var(--guest-muted); font-size: 10px; }

.member-profile-grid {
  margin: 0 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.member-profile-grid > div {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--guest-line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--guest-surface) 76%, var(--guest-surface-strong));
}

.member-profile-grid .member-profile-wide { grid-column: 1 / -1; }

.member-profile-grid dt {
  color: var(--guest-muted);
  font-size: 10px;
}

.member-profile-grid dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.member-profile-footer {
  margin-top: 18px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--guest-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.member-profile-footer p {
  margin: 0;
  align-items: flex-start;
  color: var(--guest-muted);
  font-size: 10px;
  line-height: 1.45;
}

.member-profile-footer > div { display: flex; gap: 6px; }

.member-profile-action {
  min-height: 34px;
  padding: 0 10px;
  justify-content: center;
  border: 1px solid var(--guest-line);
  border-radius: 9px;
  color: var(--guest-ink);
  background: transparent;
  font: inherit;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.member-profile-action:hover {
  border-color: color-mix(in srgb, var(--guest-accent) 36%, var(--guest-line));
  background: color-mix(in srgb, var(--guest-accent) 6%, transparent);
}

.member-profile-action.danger { color: #d94a61; }

@media (max-width: 780px) {
  .member-profile-popover {
    position: fixed;
    top: calc(max(8px, env(safe-area-inset-top)) + 58px);
    right: 10px;
    width: min(430px, calc(100vw - 20px));
    max-height: calc(100dvh - max(82px, env(safe-area-inset-top)));
    border-radius: 18px;
  }
}

@media (max-width: 480px) {
  .guest-profile-chevron { display: none; }

  .member-profile-hero {
    grid-template-columns: 50px minmax(0, 1fr) auto;
    padding: 20px 16px 15px;
  }

  .member-profile-avatar {
    width: 50px;
    height: 50px;
    border-radius: 15px;
  }

  .member-profile-identity-line,
  .member-profile-section-heading,
  .member-profile-grid {
    margin-right: 16px;
    margin-left: 16px;
  }

  .member-profile-forum { margin: 14px 16px 16px; }

  .member-profile-footer {
    padding: 13px 16px 16px;
    align-items: stretch;
    flex-direction: column;
  }

  .member-profile-footer > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* Keep the merged signed-in control visually unified after legacy profile
   rules later in this stylesheet. */
.guest-auth-signed-in .guest-session-cluster .guest-language-button-signed-in {
  height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

@media (max-width: 760px) {
  .guest-auth-signed-in .guest-session-cluster .guest-language-button-signed-in {
    height: 38px;
    padding-inline: 9px;
  }
}
