/* Scoped companion UI. The site's pages and visual identity are unchanged. */
.memory-chat-launcher { position:fixed; z-index:25; right:22px; bottom:24px; display:flex; align-items:center; justify-content:center; gap:10px; height:56px; padding:12px; border:1px solid #b5c7b0; border-radius:30px; color:#fff8eb; background:#173f35; box-shadow:0 4px 16px #082b2f55; cursor:pointer; }
.memory-chat-launcher[hidden] { display:none; }
.memory-chat-launcher svg { width:28px; height:28px; }
.memory-chat-launcher span { overflow:hidden; max-width:0; opacity:0; transition:max-width .25s,opacity .25s; }
.memory-chat-launcher.is-introduced span { max-width:90px; opacity:1; }
.memory-chat-launcher i { position:absolute; top:2px; right:1px; width:9px; height:9px; background:#d99457; border:2px solid #fff8eb; border-radius:50%; }
.memory-chat-launcher.has-reply { outline:2px solid #d99457; outline-offset:3px; }
.memory-chat-dialog { position:fixed; inset:auto 20px 20px auto; margin:0; width:460px; max-width:calc(100vw - 32px); height:min(700px,85dvh); max-height:calc(100dvh - 32px); padding:0; border:1px solid #e1d1b5; border-radius:24px; background:#fbf5e9; color:#173b37; overflow:hidden; box-shadow:0 20px 70px #071e2850; }
.memory-chat-dialog::backdrop { background:rgba(7,28,33,.3); }
.memory-chat-dialog[data-size="full"] { inset:16px; margin:auto; width:min(760px,calc(100vw - 32px)); height:calc(100dvh - 32px); }
.memory-chat-shell { position:relative; display:flex; flex-direction:column; height:100%; min-height:0; background:radial-gradient(ellipse at top,#fffdf5,#fbf5e9 65%); }
.memory-chat-dialog button { font:inherit; cursor:pointer; }
.memory-chat-dialog button:focus-visible,.memory-chat-launcher:focus-visible { outline:3px solid #b36d42; outline-offset:3px; }
.memory-chat-handle { display:flex; flex:0 0 44px; justify-content:center; align-items:center; border:0; background:none; }
.memory-chat-handle span { width:38px; height:4px; border-radius:4px; background:#aaa89e; }
.memory-chat-header { display:flex; flex:0 0 auto; gap:6px; align-items:center; padding:0 18px 10px; }
.memory-chat-header > div { flex:1; min-width:0; }
.memory-chat-header h2 { margin:0; font:600 25px/1.2 Georgia,serif; color:#123c38; }
.memory-chat-header p { margin:4px 0 0; font-size:13px; line-height:1.4; color:#58635b; }
.memory-chat-header > button,.memory-chat-subview header button { width:44px; height:44px; flex:0 0 44px; border:0; border-radius:50%; background:transparent; color:#123c38; font-size:26px; }
.memory-chat-header > button:hover { background:#ede5d6; }
.memory-chat-context-bar { display:flex; align-items:center; gap:4px; padding:0 18px 10px; }
#memory-chat-context-button { display:flex; align-items:center; gap:10px; min-height:52px; max-width:100%; padding:8px 12px; text-align:left; border:1px solid #e4d7bf; border-radius:20px; color:#173b37; background:#f3ebda; }
#memory-chat-context-button > span:nth-child(2) { display:grid; min-width:0; gap:3px; }
#memory-chat-context-icon { display:grid; place-items:center; flex:0 0 32px; width:32px; height:32px; overflow:hidden; border-radius:50%; color:#173f35; background:#e1e8d6; font-size:20px; }
#memory-chat-context-icon img { width:100%; height:100%; object-fit:cover; }
#memory-chat-context-label { font-size:13px; overflow-wrap:anywhere; }
#memory-chat-context-button small { color:#58635b; font-size:12px; }
#memory-chat-context-reset { width:44px; height:44px; border:0; color:#173b37; background:none; font-size:22px; }
.memory-chat-scroll { flex:1 1 auto; min-height:0; overflow:auto; overscroll-behavior:contain; padding:4px 18px 18px; scroll-behavior:smooth; }
.memory-chat-empty { text-align:center; padding:10px 0 4px; }
.memory-chat-empty > span { font:38px Georgia,serif; color:#557b61; }
.memory-chat-empty h3 { margin:6px 0 10px; font:600 24px/1.2 Georgia,serif; color:#173b37; }
.memory-chat-empty > p { font-size:13px; color:#58635b; margin:0 0 16px; }
.memory-chat-prompts { display:grid; gap:9px; }
.memory-chat-prompts button { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:48px; padding:11px 13px; border:1px solid #ded0b4; border-radius:16px; text-align:left; color:#173b37; background:#fffaf0; font-size:14px; line-height:1.4; }
.memory-chat-prompts button > span { font-size:22px; }
.memory-chat-dialog .memory-chat-user { width:fit-content; max-width:90%; margin:10px 0 12px auto; padding:13px 15px; border-radius:18px 18px 3px 18px; background:#1d5147; color:#fff8eb; font-size:14px; line-height:1.5; white-space:pre-wrap; overflow-wrap:anywhere; }
.memory-chat-reply,.memory-chat-turn .memory-chat-answer-bubble { margin:0 0 14px; padding:15px; border:1px solid #e6dcc8; border-radius:18px; background:#fffcf5; color:#34473e; font-size:14px; line-height:1.6; overflow-wrap:anywhere; }
#memory-chat-answer { white-space:pre-wrap; }
.memory-chat-dialog time { display:block; text-align:right; color:#68736b; font-size:11px; margin-top:8px; }
.memory-chat-source-link { display:flex; justify-content:space-between; align-items:center; gap:12px; width:100%; min-height:44px; margin-top:12px; padding:9px 12px; border:0; border-radius:12px; color:#173b37; background:#f2ebdd; font-size:13px; text-align:left; }
.memory-chat-dialog #memory-chat-next:empty { display:none; }
.memory-chat-dialog #memory-chat-next p { font-size:13px; }
.memory-chat-dialog #memory-chat-next .heritage-note { padding:10px; border:1px solid #e4d9c3; border-radius:12px; }
.memory-chat-dialog .button { min-height:44px; max-width:100%; white-space:normal; font-size:14px; }
.memory-chat-dialog #memory-collect-panel { margin-top:12px; }
.memory-chat-dialog #memory-collect-panel > summary { min-height:44px; padding:10px 0; cursor:pointer; font-size:14px; }
.memory-chat-composer { position:relative; flex:0 0 auto; display:flex; align-items:flex-end; gap:4px; margin:0 12px max(12px,env(safe-area-inset-bottom)); padding:6px; border:1px solid #e4dac7; border-radius:28px; background:#fffdf8; box-shadow:0 4px 12px #78644412; }
.memory-chat-composer button { display:grid; place-items:center; width:44px; height:44px; flex:0 0 44px; padding:0; border:0; border-radius:50%; color:#173b37; background:none; font-size:24px; }
.memory-chat-composer #memory-chat-send,.memory-chat-composer #memory-chat-voice { color:#fff8eb; background:#1d5147; }
.memory-chat-composer button:disabled { opacity:.5; cursor:wait; }
.memory-chat-composer textarea { flex:1; width:0; min-width:0; min-height:44px; max-height:120px; padding:12px 4px; border:0; border-radius:0; box-shadow:none; outline:none; background:transparent; resize:none; font:16px/1.4 Manrope,sans-serif; color:#173b37; }
.memory-chat-composer svg { width:23px; height:23px; }
.memory-chat-sr { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.memory-chat-menu { flex:0 0 auto; padding:6px 16px 12px; }
.memory-chat-menu button { display:block; min-height:44px; width:100%; padding:10px 12px; border:1px solid #e1d1b5; border-radius:12px; text-align:left; background:#fffcf5; color:#173b37; margin-bottom:6px; font-size:14px; }
.memory-chat-menu p,.memory-chat-feedback { font-size:13px; line-height:1.4; color:#58635b; margin:6px 18px; }
.memory-chat-subview { position:absolute; inset:44px 0 0; z-index:4; overflow:auto; overscroll-behavior:contain; padding:0 18px 18px; background:#fbf5e9; }
.memory-chat-subview > header { display:flex; align-items:center; justify-content:space-between; gap:12px; position:sticky; top:0; z-index:1; padding:10px 0; background:#fbf5e9; }
.memory-chat-subview h3 { margin:0; font:600 21px/1.3 Georgia,serif; }
.memory-chat-subview ul { list-style:none; padding:0; margin:10px 0; }
.memory-chat-source-card,#memory-chat-context-list button { display:flex; gap:12px; align-items:center; min-height:64px; width:100%; margin-bottom:10px; padding:13px; border:1px solid #e4d7bf; border-radius:16px; background:#fffcf5; color:#173b37; text-align:left; }
.memory-chat-source-card > span:first-child,#memory-chat-context-list button > span:first-child { display:grid; flex:0 0 34px; place-items:center; width:34px; height:34px; border-radius:12px; color:#1d5147; background:#e8eadc; font-size:20px; }
.memory-chat-source-card > div,#memory-chat-context-list button > div { display:grid; gap:5px; min-width:0; flex:1; }
.memory-chat-source-card strong,#memory-chat-context-list strong { font-size:14px; overflow-wrap:anywhere; }
.memory-chat-source-card small,#memory-chat-context-list small { font-size:12px; line-height:1.4; color:#58635b; }
.memory-chat-source-card em { font-style:normal; width:fit-content; font-size:12px; color:#365e44; background:#e7ecdf; padding:3px 7px; border-radius:9px; }
.memory-chat-source-card em.is-uncertain { color:#92502e; background:#f5e5d1; }
.memory-chat-privacy { font-size:12px; line-height:1.5; color:#58635b; }
#memory-chat-source-detail:not(:empty) { border:1px solid #e4d7bf; border-radius:16px; padding:14px; font-size:14px; line-height:1.6; white-space:pre-wrap; }
.memory-chat-dialog [hidden] { display:none!important; }
@media(max-width:760px) {
 .memory-chat-launcher { right:16px; bottom:calc(88px + env(safe-area-inset-bottom)); }
 .memory-chat-dialog { inset:auto 0 0; width:100%; max-width:100%; height:72dvh; max-height:100dvh; border-radius:24px 24px 0 0; border-bottom:0; }
 .memory-chat-dialog[data-size="full"] { inset:0; width:100%; height:100dvh; max-width:100%; border-radius:0; }
 .memory-chat-composer { gap:0; margin-left:10px; margin-right:10px; }
 .memory-chat-composer #memory-chat-send { width:38px; flex-basis:38px; }
}
@media(prefers-reduced-motion:reduce) { .memory-chat-scroll { scroll-behavior:auto; } .memory-chat-launcher span { transition:none; } }

.memory-chat-dialog #memory-chat-history:empty { display:none; }
