.lumova-chat {
    position: fixed;
    right: max(24px, env(safe-area-inset-right));
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 1200;
    font-family: var(--body-font, Arial, sans-serif);
    color: var(--text-color, #0a0a0a);
    text-align: left;
}
.lumova-chat button, .lumova-chat input { font: inherit; }
.lumova-chat button { cursor: pointer; }
.lumova-chat-launcher {
    width: 58px; height: 58px; margin-left: auto; display: grid; place-items: center;
    border: 1px solid var(--border-soft, #ddd); border-radius: 50%; background: var(--text-color, #0a0a0a);
    color: var(--surface-0, #fff); box-shadow: 0 6px 24px #0003;
}
.lumova-chat-launcher svg { width: 26px; height: 26px; }
.lumova-chat :is(button, input, a, summary, [tabindex]):focus-visible { outline: 3px solid #c96a2e; outline-offset: 3px; }
.lumova-chat-panel {
    display: flex; flex-direction: column; width: min(390px, calc(100vw - 32px));
    height: min(640px, calc(100dvh - 116px)); margin-bottom: 12px;
    border: 1px solid var(--border-soft, #ddd); border-radius: 22px;
    background: var(--surface-0, #fff); box-shadow: 0 16px 64px #0003; overflow: hidden;
}
.lumova-chat-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border-soft, #ddd); flex-shrink: 0; }
.lumova-chat-header strong { font-size: 17px; font-weight: 600; }
.lumova-chat-subtitle { font-size: 12px; color: var(--secondary-text, #696765); margin: 3px 0 0; }
.lumova-chat-close { background: transparent; border: 0; color: inherit; font-size: 28px !important; width: 44px; height: 44px; border-radius: 50%; }
.lumova-chat-log { overflow-y: auto; overscroll-behavior: contain; padding: 16px; flex: 1; min-height: 100px; }
.lumova-chat-message { width: fit-content; max-width: 94%; padding: 12px 14px; margin: 0 0 12px; border-radius: 14px 14px 14px 3px; background: var(--surface-3, #f0efee); overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; }
.lumova-chat-message p { margin: 0; font-size: inherit; line-height: inherit; }
.lumova-chat-message--user { margin-left: auto; border-radius: 14px 14px 3px 14px; background: var(--text-color, #0a0a0a); color: var(--surface-0, #fff); }
.lumova-chat-message a { display: inline-block; margin-top: 7px; color: inherit; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.lumova-chat-topics { padding: 0 16px; flex-shrink: 0; }
.lumova-chat-topics summary { cursor: pointer; padding: 8px 0; font-size: 12px; font-weight: 600; }
.lumova-chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; max-height: 110px; overflow-y: auto; overscroll-behavior: contain; padding: 3px 3px 8px; }
.lumova-chat-suggestions button { border: 1px solid var(--border-soft, #ddd); border-radius: 20px; padding: 9px 12px; background: var(--surface-0, #fff); color: inherit; font-size: 12px; }
.lumova-chat-suggestions button:hover, .lumova-chat-close:hover { background: var(--surface-3, #f0efee); }
.lumova-chat-form { padding: 8px 16px; flex-shrink: 0; }
.lumova-chat-compose { display: flex; gap: 8px; }
.lumova-chat-compose input { width: 0; min-width: 0; flex: 1; border: 1px solid var(--border-soft, #ddd); border-radius: 10px; padding: 11px; font-size: 16px; color: inherit; background: var(--surface-2, #f9f8f7); }
.lumova-chat-compose button { padding: 10px 12px; border: 0; border-radius: 10px; background: var(--text-color, #0a0a0a); color: var(--surface-0, #fff); font-size: 13px; }
.lumova-chat-notice { padding: 0 16px; font-size: 11px; line-height: 1.5; color: var(--secondary-text, #696765); margin: 0; flex-shrink: 0; }
.lumova-chat-footer { display: flex; gap: 12px; flex-wrap: wrap; padding: 10px 16px 14px; flex-shrink: 0; }
.lumova-chat-footer a, .lumova-chat-clear { color: var(--secondary-text, #696765); font-size: 11px !important; text-decoration: underline; background: none; border: 0; padding: 4px 0; }
@media (max-width: 480px) {
    .lumova-chat { right: max(16px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
    .lumova-chat-panel { height: min(600px, calc(100dvh - 104px - env(safe-area-inset-bottom, 0px))); }
}
@media (max-height: 500px) {
    .lumova-chat-panel { position: fixed; inset: 8px 8px auto auto; width: min(390px, calc(100vw - 16px)); height: calc(100dvh - 16px); margin: 0; }
    .lumova-chat-header { padding: 6px 16px; }
    .lumova-chat-suggestions { max-height: 60px; }
}
/* Keep the existing scroll control clear of the replacement launcher. */
body:has(.lumova-chat) .back-to-top { right: 24px; bottom: calc(94px + env(safe-area-inset-bottom, 0px)); }
body:has(.lumova-chat-panel:not([hidden])) .back-to-top { visibility: hidden; }
