.nf-chat { --nf-blue: #0e2aa5; --nf-light: #f5f6fb; font-family: Roboto, sans-serif; font-size: 15px; line-height: 1.45; color: #17213c; }
.nf-chat *, .nf-admin * { box-sizing: border-box; }
.nf-chat [hidden], .nf-admin [hidden] { display: none !important; }
.nf-chat button, .nf-admin button { cursor: pointer; font: inherit; }
.nf-chat button:focus-visible, .nf-chat a:focus-visible, .nf-chat textarea:focus-visible, .nf-history:focus-visible { outline: 3px solid #4f71ef; outline-offset: 3px; }
.nf-chat-launcher { position: fixed; z-index: 1000; bottom: calc(24px + env(safe-area-inset-bottom)); right: max(24px, env(safe-area-inset-right)); width: 56px; height: 56px; display: grid; place-items: center; border: 0; border-radius: 18px; background: var(--nf-blue); color: white; box-shadow: 0 8px 28px #0e2aa526; }
.nf-chat-launcher:hover, .nf-chat .nf-send:hover { background: #4f71ef; }
.nf-chat-badge { position: absolute; top: -6px; right: -6px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; background: #fff; color: var(--nf-blue); border: 2px solid var(--nf-blue); font-size: 12px; font-weight: bold; }
.nf-chat-panel { position: fixed; z-index: 1001; right: max(24px, env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom)); width: 400px; max-width: calc(100vw - 32px); height: 620px; max-height: calc(100dvh - 48px); display: flex; flex-direction: column; background: white; border: 1px solid #dfe4f3; border-radius: 20px; box-shadow: 0 16px 64px #0b1a3d29; overflow: hidden; }
.nf-chat-header { position: relative; display: flex; align-items: flex-start; padding: 22px 64px 12px 22px; background: var(--nf-blue); color: #fff; }
.nf-chat-header > div { min-width: 0; }
.nf-chat-header h2 { font-family: Montserrat, sans-serif; font-size: 19px; font-weight: 600; line-height: 1.3; margin: 0 0 7px; color: #fff; }
.nf-chat-header p { font-size: 13px; margin: 0; color: #e6ebff; }
.nf-chat-close { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 0; color: #fff; background: transparent; font-size: 28px !important; }
.nf-thread { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.nf-history { overflow-y: auto; overscroll-behavior: contain; flex: 1; padding: 16px; background: #f5f6fb; min-height: 80px; }
.nf-greeting { color: #566078; font-size: 13px; line-height: 1.6; margin: 0 6px 20px; }
.nf-message { width: fit-content; max-width: 88%; padding: 11px 13px; margin: 0 0 12px; border: 1px solid #e4e8f2; border-radius: 14px 14px 14px 3px; background: white; overflow-wrap: anywhere; }
.nf-message.nf-own { margin-left: auto; background: #e7ecff; border-color: #dce4ff; border-radius: 14px 14px 3px 14px; }
.nf-message.nf-system { background: transparent; font-style: italic; }
.nf-message-body { white-space: pre-wrap; margin: 4px 0 6px; }
.nf-message small { display: block; color: #566078; font-size: 11px; }
.nf-message-author { font-size: 12px; font-weight: 600; }
.nf-older, .nf-new { align-self: center; color: #0e2aa5; border: 1px solid #dce4ff; background: #fff; border-radius: 10px; padding: 8px 12px; margin: 0 auto 12px; }
.nf-new { margin: 6px auto; }
.nf-compose { display: flex; gap: 10px; align-items: flex-end; padding: 12px 16px; margin: 0; }
.nf-compose label.nf-sr-only { position: static; width: auto; height: auto; min-width: 0; overflow: visible; clip-path: none; flex: 1; font-size: 0; }
.nf-input { display: block; width: 100%; min-width: 0; height: 32px; min-height: 32px; max-height: calc(4 * 1.4em + 10px); resize: none; overflow-y: auto; border: 1px solid #bfc8df; border-radius: 10px; padding: 4px 10px; font: 14px/1.4 Roboto, sans-serif; background: #fff; color: #17213c; }
.nf-send { flex: none; display: grid; place-items: center; width: 32px; height: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 50%; background: #0e2aa5; color: #fff; font-size: 20px !important; line-height: 1; }
.nf-send:disabled { opacity: .6; cursor: wait; }
.nf-connection { font-size: 12px; color: #903b22; margin: 0; padding: 0 16px; }
.nf-connection:not(:empty) { padding-top: 8px; }
.nf-pending { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 110px; overflow-y: auto; padding: 8px 16px; font-size: 13px; background: #fff8ee; }
.nf-pending button { display: inline; padding: 6px; color: #0e2aa5; background: white; border: 1px solid #dce4ff; border-radius: 8px; margin-left: 8px; }
.nf-chat-privacy { font-size: 11px; color: #566078; padding: 0 16px 14px; margin: 0; overflow-wrap: anywhere; }
.nf-chat-privacy a { text-decoration: underline; color: #0e2aa5; }
.nf-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.nf-chat-modal-open { overflow: hidden !important; overscroll-behavior: none; }
@media (max-width: 600px), (max-height: 500px) and (pointer: coarse) {
  .nf-chat-panel { z-index: 2147483647; top: var(--nf-viewport-top, 0px); left: var(--nf-viewport-left, 0px); right: auto; bottom: auto; width: var(--nf-viewport-width, 100vw); max-width: 100vw; height: var(--nf-viewport-height, 100dvh); max-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); border: 0; border-radius: 0; box-shadow: none; overscroll-behavior: contain; }
  .nf-chat-header { padding-top: max(16px, env(safe-area-inset-top)); padding-right: calc(64px + env(safe-area-inset-right)); padding-left: max(22px, env(safe-area-inset-left)); }
  .nf-chat-close { top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); }
  .nf-chat-launcher { right: max(16px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); }
  .nf-chat-header h2 { font-size: 18px; }
  .nf-history { min-height: 0; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .nf-compose { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .nf-chat-privacy { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .nf-input { font-size: 16px; }
}
/* AI state uses the same history/composer and never blocks another message. */
.nf-ai-wait { margin: 0; padding: 4px 16px; font-size: 13px; color: #555; }
.nf-mode-status { margin: 0; padding: 4px 16px; font-size: 13px; color: #555; }
.nf-chat-actions { display: flex; gap: 8px; margin: 0 14px 6px; }
.nf-chat-actions > button { flex: 1 1 0; min-width: 0; padding: 7px 4px; border: 1px solid #c8cdd4; border-radius: 8px; background: #fff; color: #26334a; font-size: 13px; }
.nf-response-error { margin-top: 12px; min-width: 0; }
.nf-response-error p { white-space: pre-wrap; overflow-wrap: anywhere; }
.nf-error-response { max-height: 360px; max-width: 100%; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px; background: #fff4e6; font-size: 12px; }
