/* Global, non-modal chat. All data and conversation stay in this page. */
.jarvis-chat-root { position: fixed; z-index: 85; right: 24px; bottom: max(24px, env(safe-area-inset-bottom)); color: var(--sf-fg, #303733); font: 400 13px/1.5 var(--sf-font, Helvetica, Arial, sans-serif); pointer-events: none; }
.jarvis-chat-root *, .jarvis-chat-root *::before, .jarvis-chat-root *::after { box-sizing: border-box; }
.jarvis-chat-root [hidden] { display: none !important; }
.jarvis-chat-root svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.jarvis-chat-root button, .jarvis-chat-root select, .jarvis-chat-root textarea { font-family: inherit; }
.jarvis-chat-root :is(button, select, textarea):focus-visible { outline: 2px solid var(--sf-focus, #9465b8); outline-offset: 4px; }
.jarvis-chat-trigger { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 12px 19px; border: 0; border-radius: 999px; background: var(--sf-surface-fill, #fffffff0); color: var(--sf-fg, #303733); box-shadow: 0 7px 28px #27392d18, inset 0 1px 0 #ffffffb3; backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); font-size: 13px; cursor: pointer; pointer-events: auto; transition: background 240ms ease, box-shadow 240ms ease; }
.jarvis-chat-trigger:hover { box-shadow: 0 9px 32px #27392d23, inset 0 1px 0 #ffffffd9; }
.jarvis-chat-trigger > svg { color: var(--j-primary-ink, var(--sf-accent-strong, #8051a9)); }
.jarvis-chat-panel { display: flex; flex-direction: column; width: 420px; max-width: calc(100vw - 48px); height: min(620px, calc(100dvh - 120px)); max-height: min(680px, calc(100dvh - 120px)); overflow: hidden; border: 0; border-radius: var(--sf-radius-lg, 32px); background: linear-gradient(145deg, #ffffff99, #ffffff59); color: var(--sf-fg, #303733); box-shadow: 0 20px 70px #20312624, inset 0 1px 0 #ffffff80; backdrop-filter: blur(28px) saturate(1.2); -webkit-backdrop-filter: blur(28px) saturate(1.2); pointer-events: auto; animation: jarvis-chat-in 280ms cubic-bezier(.2,.7,.25,1); transition: opacity 220ms ease; }
.jarvis-chat-panel.is-app-blocked { opacity: .45; pointer-events: none; }
.jarvis-chat-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 20px 14px 24px; }
.jarvis-chat-header h2 { margin: 0; color: inherit; font: 400 17px/1.3 var(--sf-font, Helvetica, Arial, sans-serif); letter-spacing: -.35px; }
.jarvis-chat-header p { margin: 4px 0 0; color: var(--sf-text-muted, #808b84); font-size: 11px; line-height: 1.4; }
.jarvis-chat-close { display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; padding: 0; border: 0; border-radius: 50%; color: inherit; background: var(--sf-button-fill, #ffffffb8); box-shadow: -2px -2px 6px var(--j-round-light, #ffffffdb), 3px 4px 8px var(--j-round-shade, #4254481c); cursor: pointer; }
.jarvis-chat-close > svg { transition: transform 300ms cubic-bezier(.2,.7,.25,1); }
.jarvis-chat-close:focus-visible > svg { transform: rotate(90deg); }
.jarvis-chat-scope { display: flex; align-items: center; gap: 12px; padding: 0 24px 16px; }
.jarvis-chat-scope > label { color: var(--sf-text-muted, #808b84); font-size: 12px; }
.jarvis-chat-scope select { width: 100%; min-width: 0; min-height: 36px; padding: 7px 30px 7px 12px; border: 0; border-radius: 12px; color: inherit; background-color: var(--sf-well-fill, #e5e9e57a); font-size: 12px; text-overflow: ellipsis; }
.jarvis-chat-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 4px 24px 20px; }
.jarvis-chat-intro { margin: 14px 0 18px; max-width: 30ch; color: var(--sf-text-muted, #808b84); font-size: 13px; line-height: 1.65; }
.jarvis-chat-suggestions { display: flex; flex-direction: column; gap: 8px; }
.jarvis-chat-suggestions > button { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; padding: 12px 14px; border: 0; border-radius: 14px; color: inherit; background: var(--sf-well-fill, #e5e9e57a); font-size: 12px; line-height: 1.5; text-align: left; cursor: pointer; transition: background 240ms ease; }
.jarvis-chat-suggestions > button:hover { background: var(--sf-selected-fill, #ffffffd9); }
.jarvis-chat-suggestions svg { width: 15px; height: 15px; color: var(--sf-text-muted, #808b84); }
.jarvis-chat-log { display: flex; flex-direction: column; gap: 20px; }
.jarvis-chat-message { min-width: 0; }
.jarvis-chat-message-label { display: block; margin-bottom: 6px; color: var(--sf-text-muted, #808b84); font-size: 10px; line-height: 1.4; }
.jarvis-chat-message > p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.7; }
.jarvis-chat-message--user { align-self: flex-end; max-width: 90%; padding: 12px 15px; border-radius: 18px 18px 5px 18px; background: var(--j-primary-soft, #ac79d516); }
.jarvis-chat-message--assistant { padding: 0 2px; }
.jarvis-chat-links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.jarvis-chat-link { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 35px; max-width: 100%; padding: 8px 11px; border: 0; border-radius: 999px; background: var(--sf-button-fill, #ffffffe6); color: inherit; font-size: 12px; text-align: left; cursor: pointer; box-shadow: 0 2px 7px #20312607; }
.jarvis-chat-link > svg { width: 13px; height: 13px; }
.jarvis-chat-link:hover { background: var(--sf-selected-fill, #fff); }
.jarvis-chat-composer { display: flex; align-items: flex-end; gap: 8px; margin: 0 15px; padding: 7px; border: 0; border-radius: 20px; background: var(--sf-well-fill, #e5e9e57a); }
.jarvis-chat-composer textarea { display: block; flex: 1; min-width: 0; min-height: 42px; max-height: 140px; resize: none; padding: 10px 8px; border: 0; border-radius: 12px; background: transparent; color: inherit; font-size: 13px; line-height: 1.65; }
.jarvis-chat-composer textarea::placeholder { color: var(--sf-text-muted, #808b84); opacity: 1; }
.jarvis-chat-composer textarea:focus-visible { outline-offset: -1px; }
.jarvis-chat-send { display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--j-primary-fill, var(--sf-accent, #ac79d5)); color: #fff; cursor: pointer; transition: opacity 220ms ease, box-shadow 220ms ease; }
.jarvis-chat-send:disabled { color: var(--sf-text-muted, #808b84); background: color-mix(in srgb, var(--sf-fg, #303733) 5%, transparent); opacity: .65; cursor: default; }
.jarvis-chat-send:not(:disabled):hover { box-shadow: 0 3px 12px var(--j-primary-soft, #ac79d526); }
.jarvis-chat-footnote { flex-shrink: 0; margin: 9px 20px 15px; color: var(--sf-text-muted, #808b84); font-size: 10px; line-height: 1.4; text-align: center; }
.jarvis-chat-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
[data-theme=dark] .jarvis-chat-panel { background: linear-gradient(145deg, #28302ba6, #20282285); box-shadow: 0 20px 70px #00000040, inset 0 1px 0 #ffffff14; }
[data-theme=dark] .jarvis-chat-trigger { box-shadow: 0 7px 28px #00000029, inset 0 1px 0 #ffffff14; }
[data-theme=dark] .jarvis-chat-trigger > svg { color: var(--j-primary-light, var(--sf-accent, #ac79d5)); }
@media (hover: hover) and (pointer: fine) { .jarvis-chat-close:hover > svg { transform: rotate(90deg); } }
@media (max-width: 700px) {
  .jarvis-chat-root { right: 12px; bottom: max(92px, calc(80px + env(safe-area-inset-bottom))); }
  .jarvis-chat-trigger { min-height: 44px; padding: 10px 15px; font-size: 12px; }
  .jarvis-chat-root:has(.jarvis-chat-panel:not([hidden])) { bottom: max(12px, env(safe-area-inset-bottom)); }
  .jarvis-chat-panel { width: calc(100vw - 24px); max-width: none; height: min(620px, calc(100dvh - 36px)); max-height: min(680px, calc(100dvh - 36px)); border-radius: 26px; }
  .jarvis-chat-header { padding: 18px 17px 12px 21px; }
  .jarvis-chat-scope { padding: 0 21px 14px; }
  .jarvis-chat-body { padding-right: 21px; padding-left: 21px; }
}
@keyframes jarvis-chat-in { from { opacity: 0; translate: 0 7px; } to { opacity: 1; translate: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .jarvis-chat-root *, .jarvis-chat-root *::before, .jarvis-chat-root *::after { animation: none !important; transition: none !important; }
  .jarvis-chat-close > svg { transform: none !important; }
}
