/* UX23: readable AI Guide at the existing native R3 chat root.
 * The conversation, quick prompts, form handlers and response source stay native.
 * Scope deliberately excludes the account/document shells and editorial headings.
 */
html.r3-ui-overlay .r3-shell-layer--ai-chat {
  font-family: var(--wow-sans, "WOW Manrope", Arial, sans-serif);
  font-size: 16px;
  line-height: 1.5;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat *,
html.r3-ui-overlay .r3-shell-layer--ai-chat *::before,
html.r3-ui-overlay .r3-shell-layer--ai-chat *::after {
  box-sizing: border-box;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat :is(h1,h2,h3,h4,p,b,strong,small,span,button,textarea) {
  font-family: var(--wow-sans, "WOW Manrope", Arial, sans-serif) !important;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-shell-header {
  padding: max(16px, env(safe-area-inset-top)) 78px 16px 20px;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-shell-header h2 {
  margin: 6px 0 0;
  font-size: clamp(28px, 6.8vw, 32px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.03em;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-shell-header small {
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: .07em;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-shell-header p {
  margin-top: 7px;
  font-size: 15px;
  line-height: 1.45;
  color: #496d63;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-beta {
  display: inline-block;
  max-width: 100%;
  padding: 6px 9px;
  font-size: 13px !important;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: .015em !important;
  overflow-wrap: anywhere;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-shell-close {
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-body {
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto auto;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-stream {
  padding: 18px 16px 12px;
  scroll-padding-bottom: 16px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-message {
  min-width: 0;
  max-width: min(94%, 520px);
  margin-bottom: 13px;
  padding: 14px 16px;
  border-radius: 22px 22px 22px 8px;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-message--user {
  border-radius: 22px 22px 8px 22px;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-message > small {
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: .04em;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-message > p {
  margin: 7px 0 0;
  font-size: 16px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-status {
  display: block;
  min-width: 0;
  max-width: 520px;
  margin: 8px auto 16px;
  padding: 17px;
  border-radius: 23px;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-status > small {
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: .045em;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-status > strong {
  margin: 8px 0 12px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-status > div {
  min-height: 64px;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding-block: 9px;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-status > div > span {
  width: 32px;
  height: 32px;
  font-size: 15px;
  font-weight: 800;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-status b {
  font-size: 16px;
  line-height: 1.4;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-status p small {
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.4;
  color: #496d63;
  overflow-wrap: anywhere;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-prompts {
  gap: 8px;
  padding: 2px 16px 12px;
  scroll-padding-inline: 16px;
  scroll-snap-type: x proximity;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-prompts > button {
  min-width: 0;
  min-height: 48px;
  max-width: min(270px, 84vw);
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
  scroll-snap-align: start;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-composer {
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-composer textarea {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  max-height: 116px;
  padding: 12px;
  border-radius: 17px;
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-composer > button {
  min-width: 48px;
  min-height: 48px;
  font-size: 26px;
}
@media (max-width: 360px) {
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-shell-header {
    padding-left: 14px;
    padding-right: 72px;
  }
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-shell-close {
    right: 12px;
  }
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-stream {
    padding-inline: 12px;
  }
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-message {
    padding: 13px 14px;
  }
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-status {
    padding: 14px;
  }
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-prompts,
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-composer {
    padding-inline: 12px;
  }
}
@media (max-height: 520px) {
  /* Keep typing room when the browser keyboard/landscape reduces the viewport. */
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-shell-header {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: 12px;
  }
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-shell-header > div > small,
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-shell-header p,
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-chat-beta {
    display: none;
  }
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-shell-header h2 {
    margin-top: 0;
  }
  html.r3-ui-overlay .r3-shell-layer--ai-chat .r3-shell-close {
    top: max(8px, env(safe-area-inset-top));
  }
}

/* The live PP1 account decorator also adds Back to the AI shell. Keep its real
 * controls, but give the title its own row and the supporting copy full width.
 * PP1 uses !important font shorthands; override those only inside AI Guide.
 */
html.r3-ui-overlay .r3-shell-layer--ai-chat.pp1-shell-layer .r3-shell-header {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  grid-template-rows: auto auto auto;
  gap: 8px 10px;
  min-height: 0;
  padding: max(12px, env(safe-area-inset-top)) 16px 14px !important;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat.pp1-shell-layer .r3-shell-header > div {
  display: contents;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat.pp1-shell-layer .r3-shell-header > div > small {
  display: none;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat.pp1-shell-layer .r3-shell-header h2 {
  display: block;
  grid-column: 2;
  grid-row: 1;
  margin: 0 !important;
  font-family: var(--wow-sans, "WOW Manrope", Arial, sans-serif) !important;
  font-size: clamp(28px, 6.8vw, 32px) !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  text-align: center;
  overflow: visible;
  -webkit-line-clamp: unset;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat.pp1-shell-layer .r3-shell-header p {
  display: block;
  grid-column: 1 / -1;
  grid-row: 2;
  margin: 0 !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  line-height: 1.45 !important;
  color: #496d63 !important;
  text-align: left;
  white-space: normal;
  overflow: visible;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat.pp1-shell-layer .r3-chat-beta {
  grid-column: 1 / -1;
  grid-row: 3;
  justify-self: start;
  margin-top: 0;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat.pp1-shell-layer .pp1-shell-back {
  grid-column: 1;
  grid-row: 1;
  width: 48px;
  min-width: 48px;
  min-height: 48px;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat.pp1-shell-layer .pp1-shell-back > b {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  clip-path: none;
  white-space: normal;
  font-size: 13px;
  line-height: 1.15;
}
html.r3-ui-overlay .r3-shell-layer--ai-chat.pp1-shell-layer .r3-shell-close {
  width: 48px !important;
  grid-column: 3;
  grid-row: 1;
}
@media (max-width: 360px) {
  html.r3-ui-overlay .r3-shell-layer--ai-chat.pp1-shell-layer .r3-shell-header {
    padding-inline: 12px !important;
  }
}
@media (max-height: 520px) {
  html.r3-ui-overlay .r3-shell-layer--ai-chat.pp1-shell-layer .r3-shell-header p {
    display: none;
  }
  html.r3-ui-overlay .r3-shell-layer--ai-chat.pp1-shell-layer .r3-shell-header {
    grid-template-rows: auto;
    row-gap: 0;
    padding-bottom: 12px !important;
  }
}
