/* Sage demo chat widget (n8n workflow "Sage Website Chat Demo"). Used on every page. */
  #sage-paused {
    position: fixed; right: 20px; bottom: 20px; z-index: 9999;
    display: flex; align-items: center; gap: 10px;
    max-width: calc(100vw - 40px); box-sizing: border-box;
    padding: 12px 18px; border-radius: 999px;
    background: #062a20; color: #fff; text-decoration: none;
    font: 600 14px/1.3 "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  }
  #sage-paused .sage-note { font-weight: 400; opacity: 0.75; }
  #sage-paused:hover { background: #0b3a2d; }

  /* Sage chat: styled as a phone, matching the phone in the homepage hero */
  :root {
    --chat--color--primary: #047857;
    --chat--color--primary-shade-50: #065f46;
    --chat--color--primary--shade-100: #064e3b;
    --chat--color--secondary: #047857;
    --chat--color-secondary-shade-50: #065f46;
    --chat--color-dark: #062a20;
    --chat--color-light: #f5faf7;
    --chat--color-typing: #4a5d55;
    --chat--font-family: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;

    --chat--window--width: 340px;
    --chat--window--height: 660px;
    --chat--window--border: none;
    --chat--window--border-radius: 46px;

    --chat--header--background: #f7faf8;
    --chat--header--color: #0c1f17;
    --chat--header--padding: 50px 16px 10px;
    --chat--heading--font-size: 1rem;
    --chat--body--background: #f7faf8;
    --chat--footer--background: #f7faf8;
    --chat--footer--border-top: none;
    --chat--footer--padding: 6px 12px 10px;

    --chat--messages-list--padding: 4px 12px 10px;
    --chat--message--font-size: 0.92rem;
    --chat--message-line-height: 1.4;
    --chat--message--padding: 9px 13px;
    --chat--message--border-radius: 18px;
    --chat--message--margin-bottom: 6px;
    --chat--message--bot--background: #e4ebe7;
    --chat--message--bot--color: #0c1f17;
    --chat--message--user--background: #059669;
    --chat--message--user--color: #fff;

    --chat--input--container--background: #fff;
    --chat--input--container--border: 1px solid #dde8e2;
    --chat--input--container--border-radius: 22px;
    --chat--input--container--padding: 3px 3px 3px 14px;
    --chat--textarea--height: 36px;
    --chat--input--padding: 8px 0;
    --chat--input--font-size: 0.92rem;
    --chat--input--button--border-radius: 50%;
    --chat--input--send--button--background: #047857;
    --chat--input--send--button--color: #fff;
    --chat--input--send--button--background-hover: #065f46;
    --chat--input--send--button--color-hover: #fff;
  }

  /* Phone body and screen */
  #n8n-chat .chat-window {
    box-sizing: border-box; padding: 11px; background: #12221b;
    max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px);
    box-shadow: 0 40px 70px -30px rgba(6, 42, 32, 0.55), 0 0 0 1px rgba(6, 42, 32, 0.08);
  }
  #n8n-chat .chat-layout { position: relative; border-radius: 35px; overflow: hidden; background: #f7faf8; }
  #n8n-chat .chat-layout::before { /* camera cutout */
    content: ""; position: absolute; z-index: 3; top: 9px; left: 50%;
    width: 86px; height: 24px; margin-left: -43px; border-radius: 12px; background: #12221b;
  }

  /* Status bar (visitor's own time) and contact header */
  #n8n-chat .chat-header { position: relative; gap: 0; text-align: center; border-bottom: 1px solid #dde8e2; }
  #n8n-chat .chat-header::before,
  #n8n-chat .chat-header::after {
    position: absolute; top: 13px; font: 700 12px/1 "Manrope", system-ui, sans-serif;
    color: #0c1f17; font-variant-numeric: tabular-nums;
  }
  #n8n-chat .chat-header::before { content: var(--sage-time, "9:41"); left: 28px; }
  #n8n-chat .chat-header::after { content: "5G ▮"; right: 26px; }
  #n8n-chat .chat-heading { flex-direction: column; justify-content: center; gap: 6px; }
  #n8n-chat .chat-heading::before { /* contact photo */
    content: "S"; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
    background: linear-gradient(145deg, #34d399, #047857); color: #fff;
    font: 700 20px/1 "Outfit", "Manrope", system-ui, sans-serif;
  }
  #n8n-chat .chat-header h1 { margin: 0; font-family: "Outfit", "Manrope", system-ui, sans-serif; font-weight: 700; letter-spacing: -0.01em; }
  #n8n-chat .chat-header p { margin: 2px 0 0; font-size: 0.72rem; line-height: 1.3; color: #4a5d55; }

  /* Text bubbles */
  #n8n-chat .chat-messages-list::before {
    content: "Text Message · Today"; display: block; margin: 8px 0 10px; text-align: center;
    font-size: 0.68rem; font-weight: 600; color: #4a5d55;
  }
  /* Bubbles hug their text (a short "hvac" stays a small bubble) and stop at 80% of the screen */
  #n8n-chat .chat-message { max-width: 80%; width: -moz-fit-content; width: fit-content; box-sizing: border-box; }
  #n8n-chat .chat-message.chat-message-from-bot { border-bottom-left-radius: 5px; margin-right: auto; }
  #n8n-chat .chat-message.chat-message-from-user { border-bottom-right-radius: 5px; margin-left: auto; }
  #n8n-chat .chat-message-typing .chat-message-typing-circle { width: 7px; height: 7px; }

  /* Message box and home bar */
  #n8n-chat .chat-inputs { align-items: center; }
  #n8n-chat .chat-inputs:focus-within { border-color: #059669; }
  #n8n-chat .chat-inputs textarea,
  #n8n-chat .chat-inputs textarea:focus {
    border: 0; outline: none; box-shadow: none; background: transparent; border-radius: 0;
  }
  /* "Try Sage" pop-up next to the chat button */
  #sage-hint {
    position: fixed; right: 92px; bottom: 29px; z-index: 9999;
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    border: 1px solid #dde8e2; border-radius: 16px 16px 4px 16px; background: #fff; color: #0c1f17;
    font: 700 14px/1.2 "Manrope", "Segoe UI", system-ui, sans-serif; cursor: pointer;
    box-shadow: 0 12px 30px -10px rgba(6, 42, 32, 0.35);
    opacity: 0; transform: translateY(6px) scale(0.96); transform-origin: 100% 100%;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }
  #sage-hint.show { opacity: 1; transform: none; }
  #sage-hint:hover { border-color: #059669; }
  #sage-hint .sage-hint-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
  }
  @media (prefers-reduced-motion: reduce) { #sage-hint { transition: none; } }

  #n8n-chat .chat-footer::after {
    content: ""; display: block; width: 118px; height: 5px; margin: 12px auto 0;
    border-radius: 3px; background: #0c1f17; opacity: 0.85;
  }

  /* Demo finished: the message box is replaced by a "Book your free call" button */
  .sage-ended #n8n-chat .chat-input { display: none; }
  #sage-ended { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 2px; text-align: center; }
  #sage-ended .sage-ended-note {
    margin: 0; font: 600 0.75rem/1.3 "Manrope", "Segoe UI", system-ui, sans-serif; color: #4a5d55;
  }
  #sage-ended a {
    display: block; width: 100%; box-sizing: border-box; padding: 11px 16px; border-radius: 22px;
    background: #047857; color: #fff; text-decoration: none; text-align: center;
    font: 700 0.92rem/1.2 "Manrope", "Segoe UI", system-ui, sans-serif;
  }
  #sage-ended a:hover { background: #065f46; }
  #sage-ended a:focus-visible { outline: 2px solid #062a20; outline-offset: 2px; }
