/* One persistent entry; a readable right-hand window, never a page-blocking modal. */
.ai-floating-launch { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 56px; border: 0; font: 750 17px Manrope, sans-serif; cursor: pointer; }
.ai-floating-launch { position: fixed; z-index: 75; right: 28px; bottom: 26px; padding: 16px 24px; border-radius: 18px; background: var(--brand-signal); color: #1b2025; box-shadow: 0 8px 30px #0003; }
.ai-floating-launch:hover { background: #efffc6; transform: translateY(-2px); }
.ai-chat[hidden],.ai-chat [hidden] { display: none !important; }
body.ai-chat-open .ai-floating-launch { visibility: hidden; }
.ai-chat { --ai-bg: var(--surface); --ai-text: var(--ink); --ai-muted: var(--muted); --ai-line: var(--line); --ai-input: var(--soft); position: fixed; z-index: 90; top: auto; right: 24px; bottom: 24px; left: auto; width: min(580px, calc(100vw - 48px)); height: min(780px, calc(100dvh - 112px)); margin: 0; display: flex; flex-direction: column; color: var(--ai-text); background: var(--ai-bg); border: 1px solid var(--ai-line); border-radius: 24px; box-shadow: 0 24px 100px #0005; overflow: hidden; }
.ai-chat-header { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; padding: 18px 22px; gap: 18px; border-bottom: 1px solid var(--ai-line); }
.ai-chat-header-actions { display: flex; align-items: center; gap: 18px; min-width: 0; }
.ai-chat-header h2 { font-size: 28px; line-height: 1; margin: 0; letter-spacing: -.035em; }
.ai-chat p { font-size: 16px; line-height: 1.65; }
.ai-close-button,.ai-quiet-button { display: inline-flex; align-items: center; justify-content: center; background: transparent; color: inherit; border: 0; min-height: 44px; border-radius: 10px; font: inherit; font-size: 15px; cursor: pointer; }
.ai-quiet-button { padding: 8px 12px; }
.ai-close-button { width: 44px; font-size: 30px; line-height: 1; }
.ai-close-button:hover,.ai-quiet-button:hover { background: var(--ai-input); }
.ai-chat-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; flex: 1; padding: 20px 24px; display: flex; flex-direction: column; scrollbar-width: thin; }
.ai-chat-setup { padding: 14px 18px; margin-bottom: 24px; background: var(--ai-input); border-radius: 12px; }
.ai-chat-setup p { margin: 0; font-size: 15px; line-height: 1.6; }
.ai-chat-setup details { margin-top: 8px; }
.ai-chat-setup summary { font-size: 14px; color: var(--ai-muted); cursor: pointer; }
.ai-chat-setup details p { margin: 12px 0 4px; }
.ai-chat-messages { display: flex; flex-direction: column; gap: 24px; }
.ai-editor-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.ai-editor-actions .ai-quiet-button { border: 1px solid var(--ai-line); }
.ai-build-panel { padding: 16px; margin-bottom: 20px; border: 1px solid var(--ai-line); border-radius: 14px; }
.ai-build-panel h3,.ai-build-panel p { margin: 0 0 8px; }
.ai-build-panel button { margin-top: 12px; }
.ai-field-diff { min-width: 0; margin: 0; padding: 0; border: 0; }
.ai-field-diff legend { font-weight: 700; }
.ai-chat .ai-before { color: var(--ai-muted); font-size: 14px; margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-field-diff [id^="ai-edit-feature-"] + input { margin-top: 6px; }
.ai-message { max-width: 88%; align-self: flex-start; padding: 0; }
.ai-message[data-role="user"] { padding: 14px 20px; border-radius: 20px 20px 5px 20px; background: var(--ai-input); align-self: flex-end; }
.ai-message strong { display: none; }
.ai-message p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font-size: 17px; line-height: 1.7; }
.ai-message-model { display: block; margin-top: 4px; color: var(--ai-muted); font-size: 14px; }
.ai-chat-options { margin-top: auto; padding-top: 24px; }
.ai-chat-options summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; cursor: pointer; color: var(--ai-muted); list-style: none; padding: 10px 0; }
.ai-chat-options summary::-webkit-details-marker { display: none; }
.ai-chat-options summary > span { font-size: 24px; line-height: 1; }
.ai-chat-options[open] summary > span { transform: rotate(45deg); }
.ai-chat label { display: block; font-size: 15px; margin: 18px 0 8px; }
.ai-chat input:not([type="checkbox"]),.ai-chat textarea,.ai-chat select { box-sizing: border-box; width: 100%; border: 1px solid var(--ai-line); background: var(--ai-bg); color: inherit; border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 16px; line-height: 1.5; }
.ai-chat textarea { resize: vertical; min-height: 72px; max-height: 200px; }
.ai-options-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ai-chat .ai-check { display: flex; gap: 10px; align-items: flex-start; line-height: 1.6; font-size: 15px; }
.ai-check input { flex: 0 0 auto; width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--brand-accent); }
.ai-chat-proposal { border: 1px solid var(--ai-line); border-radius: 18px; padding: 24px; margin-top: 28px; }
.ai-chat-proposal h3 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.ai-chat-proposal > p { margin: 10px 0 18px; color: var(--ai-muted); }
#ai-proposal-preview { display: block; width: 240px; height: auto; max-height: 390px; max-width: 100%; object-fit: contain; margin: 20px auto; border-radius: 10px; }
.ai-chat-proposal .workflow-actions { margin-bottom: 0; gap: 16px; }
.ai-chat-proposal .workflow-actions button { min-height: 48px; font-size: 16px; }
.ai-chat-composer { flex: 0 0 auto; padding: 16px 24px 20px; background: var(--ai-bg); }
.ai-input-shell { display: flex; align-items: flex-end; gap: 12px; padding: 8px 10px 8px 16px; border: 1px solid var(--ai-line); background: var(--ai-input); border-radius: 18px; }
.ai-input-shell:focus-within { border-color: #a5aaa6; box-shadow: 0 0 0 1px #a5aaa6; }
.ai-chat #ai-chat-input { display: block; flex: 1; min-width: 0; background: transparent; border: 0; padding: 8px 0; height: 44px; min-height: 44px; max-height: 140px; overflow-y: hidden; font-size: 18px; resize: none; outline: 0; box-shadow: none; }
#ai-chat-status { font-size: 15px; margin: 0 0 12px; }
#ai-chat-status:empty { display: none; }
#ai-chat-status.error { color: #b43220; }
.ai-chat-send-row { display: flex; flex: 0 0 auto; gap: 8px; align-items: center; }
.ai-send-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; min-width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--brand-accent); color: var(--brand-on-accent); padding: 0; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.ai-send-button span { font-size: 22px; line-height: 1; }
.ai-data-consent { margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--ai-line); border-radius: 14px; }
.ai-data-consent p { margin: 0; font-size: 15px; }
#ai-google-data-policy { color: var(--ai-muted); font-size: 14px; text-decoration: underline; }
.ai-data-consent > div { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
#ai-data-confirm { background: var(--brand-accent); color: var(--brand-on-accent); }
.ai-chat button:disabled { opacity: .45; cursor: not-allowed; }
.ai-chat .ai-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"] #ai-chat-status.error { color: #ffb09e; }
@media(max-width:700px) { .ai-floating-launch { right: 16px; bottom: 82px; min-height: 52px; padding: 14px 18px; font-size: 16px; } .ai-chat { top: auto; right: 10px; bottom: max(78px, calc(env(safe-area-inset-bottom) + 70px)); left: auto; width: calc(100vw - 20px); height: min(720px, calc(100dvh - 110px)); border-radius: 20px; } .ai-chat-header { padding: 14px 16px; gap: 10px; } .ai-chat-header h2 { font-size: 26px; } .ai-chat-header-actions { gap: 2px; } .ai-chat-header .ai-quiet-button { font-size: 14px; padding: 8px; } .ai-chat-scroll { padding: 18px 20px; } .ai-chat-setup { padding: 12px 14px; margin-bottom: 20px; } .ai-message { max-width: 95%; } .ai-message p { font-size: 16px; } .ai-chat-composer { padding: 12px 16px max(16px, env(safe-area-inset-bottom)); } .ai-chat #ai-chat-input { font-size: 17px; } .ai-input-shell { padding: 8px 8px 8px 12px; } .ai-chat-proposal { padding: 18px; } }
@media(max-height:650px) { .ai-chat { top: auto; bottom: 12px; height: calc(100dvh - 24px); } .ai-chat-header { padding-block: 10px; } .ai-chat-composer { padding-block: 10px; } }
@media(prefers-reduced-motion:reduce) { .ai-floating-launch:hover { transform: none; } }
