.r-ai-chat { --ai-accent: var(--r-text-blue, #334c91); box-sizing: border-box; position: relative; display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 0; height: var(--r-ai-chat-height, 100dvh); max-width: 960px; margin: 0 auto; padding: 40px 24px 20px; color: var(--r-ink, #1f2937); font-family: inherit; }
.r-ai-chat:not(.r-ai-chat-active) { justify-content: center; }
.r-ai-chat *, .r-ai-chat *::before, .r-ai-chat *::after { box-sizing: border-box; }
.r-ai-chat [hidden] { display: none !important; }
.r-ai-chat-intro { text-align: center; }
.r-ai-chat-eyebrow { font-size: 11px; letter-spacing: .17em; font-weight: 600; color: var(--r-muted, #6b7280); }
.r-ai-chat-intro h2 { margin: 20px 0 12px; font-size: clamp(30px, 4.5vw, 48px); line-height: 1.15; font-weight: 500; letter-spacing: -.035em; color: inherit; }
.r-ai-chat-intro p { margin: 0 0 30px; color: var(--r-muted, #6b7280); font-size: 16px; }
.r-ai-chat-dock { flex: 0 0 auto; width: 100%; min-width: 0; max-width: 800px; margin: 0 auto; }
.r-ai-chat-form { display: flex; width: 100%; min-width: 0; align-items: center; gap: 14px; padding: 10px 12px 10px 22px; border: 1px solid var(--r-border, #dadce0); border-radius: 34px; background: var(--r-surface, #fff); box-shadow: 0 3px 16px #0000000a; transition: box-shadow .2s, border-color .2s; }
.r-ai-chat-form:focus-within { border-color: var(--ai-accent); box-shadow: 0 3px 20px #334c911a; }
.r-ai-chat-search-icon { width: 22px; height: 22px; flex: 0 0 22px; color: var(--r-muted, #6b7280); }
.r-ai-chat .r-ai-chat-form textarea { display: block; flex: 1 1 0%; width: 100%; min-width: 0; height: 28px; min-height: 28px; max-height: 140px; margin: 0; padding: 3px 0; resize: none; overflow-y: hidden; border: 0; outline: 0; box-shadow: none; border-radius: 0; background: transparent; color: inherit; font: inherit; font-size: 16px; line-height: 22px; }
.r-ai-chat-form textarea::placeholder { color: var(--r-muted, #89909a); opacity: 1; }
.r-ai-chat button { font: inherit; cursor: pointer; }
.r-ai-chat-submit, .r-ai-chat-stop { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 40px; padding: 8px 16px; border-radius: 24px; border: 0; background: var(--r-surface-muted, #f1f3f8); color: var(--ai-accent); font-size: 14px !important; font-weight: 600 !important; }
.r-ai-chat-submit:hover, .r-ai-chat-stop:hover { background: var(--r-surface-accent, #e7ebf5); }
.r-ai-chat-submit { position: relative; isolation: isolate; padding: 4px 4px 4px 16px; }
.r-ai-chat-submit > span, .r-ai-chat-submit svg, .r-ai-chat-submit path { pointer-events: none; }
.r-ai-chat-submit-icon { display: inline-flex; flex: 0 0 32px; align-items: center; justify-content: center; width: 32px; height: 32px; color: inherit; }
.r-ai-chat-submit-icon svg, .r-help-article-arrow { margin: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
@property --r-ai-chat-ring-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.r-ai-chat-submit::before, .r-ai-chat-submit::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 2px; pointer-events: none; opacity: 0; transition: opacity .18s ease; background: conic-gradient(from var(--r-ai-chat-ring-angle), transparent 0deg 190deg, #8ab4f8 220deg, #81c995 255deg, #fdd663 285deg, #f28b82 315deg, transparent 350deg); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); mask-composite: exclude; }
.r-ai-chat-submit::after { inset: -2px; padding: 3px; filter: blur(3px); }
@media (hover: hover) { .r-ai-chat-submit:not(:disabled):hover::before, .r-ai-chat-submit:not(:disabled):hover::after { opacity: 1; animation: r-ai-chat-button-orbit 1.8s linear infinite; } }
@keyframes r-ai-chat-button-orbit { to { --r-ai-chat-ring-angle: 360deg; } }
.r-ai-chat button:focus-visible, .r-ai-chat-thread:focus-visible { outline: 2px solid var(--ai-accent); outline-offset: 3px; }
.r-ai-chat button:disabled { opacity: .55; cursor: default; }
.r-ai-chat-suggestions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 22px 0; }
.r-ai-chat-suggestions button { background: var(--r-surface, #fff); color: var(--r-muted, #5f6776); border: 1px solid var(--r-border, #e5e7eb); border-radius: 18px; padding: 8px 13px; font-size: 12px; }
.r-ai-chat-suggestions button:hover { border-color: var(--ai-accent); color: var(--ai-accent); }
.r-ai-chat-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 8px; color: var(--r-muted, #7b8190); font-size: 11px; }
.r-ai-chat-reset { flex-shrink: 0; color: var(--ai-accent); border: 0; padding: 4px; background: none; text-decoration: underline; }
.r-ai-chat-status { flex: 1; min-height: 20px; margin: 0; color: var(--r-muted, #6b7280); font-size: 13px; }
.r-ai-chat-status.r-ai-chat-error { color: var(--r-text-red, #b42318); }
.r-ai-chat.r-ai-chat-active .r-ai-chat-intro { display: none; }
.r-ai-chat.r-ai-chat-active .r-ai-chat-suggestions { display: none; }
.r-ai-chat.r-ai-chat-active .r-ai-chat-dock { margin-top: auto; padding-top: 18px; }
.r-ai-chat-thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 8px 16px 8px 0; }
.r-ai-chat-message { margin: 0 0 26px; line-height: 1.65; overflow-wrap: anywhere; font-size: 15px; }
.r-ai-chat-message > h3 { margin: 0 0 8px; font-size: 11px; letter-spacing: .1em; font-weight: 700; text-transform: uppercase; color: var(--r-muted, #6b7280); }
.r-ai-chat-message-user { margin-left: auto; max-width: 85%; width: fit-content; border-radius: 22px 22px 4px 22px; background: var(--r-surface-muted, #f2f4f8); padding: 13px 20px; }
.r-ai-chat-message-user .r-ai-chat-message-body { white-space: pre-wrap; }
.r-ai-chat-message-assistant { padding: 0 8px; }
.r-ai-chat-company { display: flex; align-items: center; gap: 16px; margin: 0 0 16px; min-width: 0; }
.r-ai-chat-company > .r-rating-wrap { flex: 0 0 auto; margin: 0; }
.r-ai-chat-company .r-rating { cursor: default; }
.r-ai-chat-company .r-rating[data-key] { cursor: pointer; }
.r-ai-chat-company .r-rating.r-ipo { min-width: 48px; width: auto; flex-basis: auto; padding: 0 6px; font-size: 20px; }
.r-ai-chat-company-info { display: flex; flex-direction: column; min-width: 0; color: inherit; text-decoration: none; }
.r-ai-chat-company-name { font-size: 20px; line-height: 26px; font-weight: 400; }
a.r-ai-chat-company-info:hover .r-ai-chat-company-name { text-decoration: underline; }
.r-ai-chat-company-details { font-size: 15px; line-height: 20px; }
.r-ai-chat-company-exchange, .r-ai-chat-company-ipo { color: var(--r-muted, #6b7280); }
.r-ai-chat-company-ipo { display: block; font-size: 12px; }
.r-ai-chat-company a:focus-visible, .r-ai-chat-company [role="button"]:focus-visible { outline: 2px solid var(--ai-accent); outline-offset: 3px; }
.r-ai-chat-thinking { display: inline-flex; align-items: center; gap: 5px; min-height: 25px; padding: 4px 0; color: var(--r-muted, #6b7280); }
.r-ai-chat-thinking > span { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: r-ai-chat-thinking 1.2s ease-in-out infinite; }
.r-ai-chat-thinking > span:nth-child(2) { animation-delay: .15s; }
.r-ai-chat-thinking > span:nth-child(3) { animation-delay: .3s; }
@keyframes r-ai-chat-thinking { 0%, 70%, 100% { opacity: .3; } 35% { opacity: 1; } }
.r-ai-chat-message-body > :first-child { margin-top: 0; }
.r-ai-chat-message-body > :last-child { margin-bottom: 0; }
.r-ai-chat-message-body table { display: block; max-width: 100%; width: max-content; overflow-x: auto; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.r-ai-chat-message-body th, .r-ai-chat-message-body td { border-bottom: 1px solid var(--r-border, #e5e7eb); padding: 9px 16px 9px 0; text-align: left; }
.r-ai-chat-message-body a { color: var(--ai-accent); text-decoration: underline; }
.r-ai-chat-message-body pre { overflow-x: auto; }
.r-ai-chat-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 600px) { .r-ai-chat { padding: 24px 12px 10px; } .r-ai-chat-form { gap: 9px; padding-left: 16px; } .r-ai-chat-button-label { display: none; } .r-ai-chat-submit { gap: 7px; padding-left: 10px; } .r-ai-chat-footer { font-size: 10px; } .r-ai-chat-suggestions { gap: 8px; } .r-ai-chat-message-user { max-width: 95%; } }
@media (prefers-reduced-motion: reduce) { .r-ai-chat *, .r-ai-chat *::before, .r-ai-chat *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Show common articles before a conversation, then use the available viewport for chat. */
.r-ai-chat.r-ai-chat-help { height: auto; padding: 24px 0 12px; }
.r-ai-chat-help .r-ai-chat-eyebrow { display: none; }
.r-ai-chat-help .r-ai-chat-intro h2 { margin-top: 0; font-size: clamp(26px, 4vw, 36px); }
.r-ai-chat-help.r-ai-chat-active { height: var(--r-ai-chat-height, 100dvh); min-height: 0; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.r-ai-chat-help.r-ai-chat-active ~ .r-help-common { display: none; }
.r-help-common { margin: 1rem 0 2rem; }
.r-help-common h2 { font-size: 1.5rem; margin-bottom: 1rem; }
.r-help-articles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0; list-style: none; }
.r-help-articles a { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 100%; padding: 16px; border: 1px solid var(--r-border, #dadce0); border-radius: 8px; color: var(--r-text-blue, #334c91); overflow-wrap: anywhere; text-decoration: none; }
.r-help-articles a:hover { background: var(--r-surface-muted, #f1f3f8); text-decoration: none; }
.r-help-articles a:hover .r-help-article-title, .r-help-articles a:focus-visible .r-help-article-title { text-decoration: underline; }
.r-help-articles a:focus-visible { outline: 2px solid var(--r-text-blue, #334c91); outline-offset: 3px; }
.r-help-article-title { min-width: 0; }
.r-help-article-arrow { display: block; flex-shrink: 0; }
@media (max-width: 600px) { .r-help-articles { grid-template-columns: 1fr; } }

/* Stock pages reuse the chat button and conversation without replacing the stock header. */
.r-stock-ai-trigger { --ai-accent: var(--r-text-blue, #334c91); box-sizing: border-box; font: inherit; cursor: pointer; color: #fff; border: 1px solid #7aa6f7; background: linear-gradient(135deg, #3768c9, #25488f); box-shadow: none; transition: border-color .18s ease; }
.r-stock-ai-trigger:hover { background: linear-gradient(135deg, #3c6dcb, #2d549e); border-color: #9bbdff; }
.r-stock-ai-trigger::after { display: none; }
/* The action bar's .5rem gap plus this margin leaves 1rem before My Lists. */
.r-actions-bar > .r-stock-ai-trigger { height: 2rem; min-height: 0; padding-block: 0; margin-inline-end: .5rem; }
.r-stock-ai-trigger .r-ai-chat-submit-icon { height: 100%; }
.r-stock-ai-trigger:focus-visible { outline: 2px solid var(--r-text-blue, #334c91); outline-offset: 3px; }
.r-stock-ai-trigger:disabled { opacity: .55; cursor: default; }
.r-stock-ai-trigger .r-ai-chat-button-label { display: inline; }
.r-stock-ai-panel[hidden], .r-stock-ai-suppressed { display: none !important; }
.r-stock-ai-open { display: block !important; }
.r-stock-ai-panel { width: 100%; min-width: 0; }
.r-stock-ai-panel .r-ai-chat { max-width: none; padding: 16px 12px 12px; }
.r-stock-ai-panel .r-ai-chat-thread { width: 100%; max-width: 1100px; margin: 0 auto; }
.r-stock-ai-panel .r-ai-chat-eyebrow { display: none; }
.r-stock-ai-panel .r-ai-chat-intro h2 { font-size: clamp(24px, 4vw, 36px); }
@media (max-width: 600px) { .r-stock-ai-panel .r-ai-chat { padding-inline: 0; } }
@media (prefers-reduced-motion: reduce) { .r-stock-ai-trigger, .r-stock-ai-trigger::before, .r-stock-ai-trigger::after { animation: none !important; transition: none !important; } }
