#fw-chat { --chat-bg: var(--bg, #F5F2E9); --chat-fg: var(--fg, #172820); position: fixed; z-index: 1000; right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); color: var(--chat-fg); font: 16px/1.5 'DM Sans', Arial, sans-serif; }
#fw-chat *, #fw-chat *::before, #fw-chat *::after { box-sizing: border-box; }
#fw-chat [hidden] { display: none !important; }
#fw-chat button, #fw-chat a { min-height: 44px; min-width: 44px; }
#fw-chat button, #fw-chat textarea { font: inherit; color: inherit; background: var(--chat-bg); border: 1px solid var(--line, #7F9184); border-radius: 4px; padding: .6rem .75rem; }
#fw-chat button { cursor: pointer; }
#fw-chat button:disabled { opacity: .55; cursor: not-allowed; }
#fw-chat :focus-visible { outline: 2px solid var(--chat-fg); outline-offset: 2px; }
#fw-chat a { color: inherit; display: inline-flex; align-items: center; padding: .4rem 0; overflow-wrap: anywhere; }
#fw-chat > button, #fw-chat button[type="submit"] { background: var(--accent, #F26337); color: var(--on-accent, #172820); border-color: var(--accent, #F26337); font-weight: 700; }
#fw-chat-panel { width: min(460px, calc(100vw - 2rem)); height: min(720px, calc(100dvh - 6rem)); background: var(--chat-bg); border: 1px solid var(--line, #7F9184); border-radius: 8px; box-shadow: 0 8px 32px #0003; display: flex; flex-direction: column; overflow: hidden; overscroll-behavior: contain; }
#fw-chat .fw-chat-header { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; padding: .5rem .75rem; border-bottom: 1px solid var(--line, #7F9184); }
#fw-chat .fw-chat-header strong { font: 700 26px/1.1 'Barlow Condensed', 'Arial Narrow', sans-serif; }
#fw-chat .fw-chat-body { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow-y: auto; padding: .75rem; gap: .5rem; }
#fw-chat .fw-chat-body:has([role="log"]) { overflow: hidden; padding: 0; }
#fw-chat .fw-chat-toolbar { display: flex; justify-content: space-between; flex-shrink: 0; padding: .5rem .75rem; border-bottom: 1px solid var(--line, #7F9184); }
#fw-chat [role="log"] { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; overflow-wrap: anywhere; white-space: pre-wrap; padding: .75rem; }
#fw-chat .fw-chat-message { max-width: 100%; margin: 0 0 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
#fw-chat .fw-chat-message[data-role="user"] { margin-left: 1.5rem; background: var(--tint, #CFD8C7); padding: .65rem .8rem; border-radius: 6px; }
#fw-chat .fw-chat-empty { color: var(--muted, #59635A); margin: .5rem 0; }
#fw-chat .fw-chat-status { flex-shrink: 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: 0 .75rem; font-size: 14px; }
#fw-chat .fw-chat-status:has(span:empty):not(:has(button)) { display: none; }
#fw-chat form { display: flex; gap: .5rem; align-items: flex-end; flex-shrink: 0; padding: .75rem; margin: 0; border-top: 1px solid var(--line, #7F9184); }
#fw-chat textarea { flex: 1; width: 100%; min-width: 0; min-height: 60px; height: 60px; max-height: min(120px, 25dvh); resize: none; font-size: 16px; }
#fw-chat .fw-chat-actions { display: flex; flex-direction: column; gap: .4rem; }
#fw-chat .fw-chat-threads { flex: 1; min-height: 0; overflow-y: auto; padding: .75rem; }
#fw-chat .fw-chat-threads button { display: block; width: 100%; text-align: left; margin-bottom: .5rem; overflow-wrap: anywhere; }
#fw-chat .fw-chat-latest { align-self: center; flex-shrink: 0; }
#fw-chat label { display: flex; align-items: center; gap: .6rem; min-height: 44px; }
#fw-chat input[type="checkbox"] { min-width: 24px; min-height: 24px; }
#fw-chat .fw-chat-card { border: 1px solid var(--line, #7F9184); border-radius: 4px; padding: .65rem; margin-top: .5rem; min-width: 0; }
#fw-chat .fw-chat-card > a:first-child { font-weight: 700; }
@media (max-width: 600px) {
  #fw-chat:has(#fw-chat-panel:not([hidden])) { inset: var(--fw-chat-top, 0px) 0 auto; }
  #fw-chat-panel { width: 100%; height: var(--fw-chat-height, 100dvh); border: 0; border-radius: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  #fw-chat:has(#fw-chat-panel:not([hidden])) > button { display: none; }
}
@media (prefers-reduced-motion: reduce) { #fw-chat * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
