:root {
    --antimanual_primary_color: #0066cc;
    --antimanual_white_color: #ffffff;
    --antimanual_input_border: #86B7FE;
    --antimanual_input_outline: #C2DBFE;
    --black_25: #f9f9f9;
    --black_50: #f2f2f2;
    --black_75: #eeeeee;
    --black_100: #d6d9dc;
    --black_150: #c8ccd0;
    --black_200: #bbc0c4;
    --black_300: #9fa6ad;
    --black_350: #9199a1;
    --black_400: #848d95;
    --black_500: #6a737c;
    --black_600: #535a60;
    --black_700: #3c4146;
    --black_750: #2f3337;
    --black_800: #242729;
    --black_900: #0c0d0e;
    --bs-white: #ffffff;
    --bs_sm: 0 1px 2px rgb(0 0 0 / 5%), 0 1px 4px rgb(0 0 0 / 5%), 0 2px 8px rgb(0 0 0 / 5%);
    --bs_md: 0 1px 3px rgb(0 0 0 / 6%), 0 2px 6px rgb(0 0 0 / 6%), 0 3px 8px rgb(0 0 0 / 9%);
    --bs_lg: 0 1px 4px rgb(0 0 0 / 9%), 0 3px 8px rgb(0 0 0 / 9%), 0 4px 13px rgb(0 0 0 / 13%);
}

.bs-sm {
    box-shadow: var(--bs_sm) !important;
}

.bs-md {
    box-shadow: var(--bs_md) !important;
}

.bs-lg {
    box-shadow: var(--bs_lg) !important;
}

/** Hover Classes **/
.h\:bs-md:hover {
    box-shadow: var(--bs_md) !important;
}

.h\:bs-lg:hover {
    box-shadow: var(--bs_md) !important;
}

/* Chat-bubble friendly typography — compact, native chatbot feel.
   Sized in em so it inherits the message's base font-size. */
.atml-msg-html {
    line-height: 1.5;
    color: var(--black_800);
    word-wrap: break-word;
    overflow-wrap: anywhere;

    /* Trim outer whitespace so the bubble hugs the content */
    > *:first-child { margin-top: 0; }
    > *:last-child  { margin-bottom: 0; }

    p {
        margin: 0.45em 0;
    }

    h1, h2, h3, h4, h5, h6 {
        margin: 0.7em 0 0.25em;
        font-weight: 600;
        line-height: 1.3;
        color: var(--black_900);
        border: 0;
        padding: 0;

        &:first-child { margin-top: 0; }
    }

    h1 { font-size: 1.08em; }
    h2 { font-size: 1.05em; }
    h3 { font-size: 1em; color: var(--black_700); }
    h4, h5, h6 { font-size: 0.95em; color: var(--black_700); }

    strong { font-weight: 600; color: var(--black_900); }
    em     { font-style: italic; color: var(--black_700); }

    a {
        color: var(--antimanual_primary_color);
        text-decoration: underline;
        text-decoration-thickness: 1px;
        text-underline-offset: 2px;
        transition: opacity 0.15s ease;
        word-break: break-word;

        &:hover { opacity: 0.75; }
    }

    /* Inline code */
    code {
        background: var(--black_50);
        padding: 1px 5px;
        border-radius: 4px;
        font-family: ui-monospace, "SF Mono", "Fira Code", Menlo, Consolas, monospace;
        font-size: 0.87em;
        color: var(--black_900);
        word-break: break-word;
    }

    /* Block code */
    pre {
        background: var(--black_50);
        padding: 8px 10px;
        margin: 0.5em 0;
        border-radius: 6px;
        font-family: ui-monospace, "SF Mono", "Fira Code", Menlo, Consolas, monospace;
        font-size: 0.85em;
        line-height: 1.45;
        overflow-x: auto;

        code {
            background: transparent;
            padding: 0;
            border-radius: 0;
            font-size: 1em;
            color: inherit;
            white-space: pre;
        }
    }

    img {
        max-width: 100%;
        height: auto;
        border-radius: 6px;
        margin: 0.4em 0;
        display: block;
    }

    /* Lists — tight, no excess indent. padding-left holds bullets inside
       the bubble; margins are minimal. */
    ul, ol {
        margin: 0.35em 0;
        padding-left: 1.25em;
    }

    li {
        margin: 0.12em 0;
        line-height: 1.5;
        color: var(--black_800);

        > p { margin: 0; }

        ul, ol { margin: 0.15em 0; }
    }

    ul { list-style: disc; }
    ol { list-style: decimal; }

    /* Blockquote — soft accent rail, not a heavy quote */
    blockquote {
        margin: 0.5em 0;
        padding: 0.15em 0.75em;
        border-left: 2px solid var(--antimanual_primary_color);
        color: var(--black_600);
        background: transparent;
    }

    /* Horizontal rule — slim divider between thoughts */
    hr {
        border: 0;
        border-top: 1px solid var(--black_75);
        margin: 0.7em 0;
    }

    /* Tables — narrow bubbles can't hold wide tables, so let them scroll */
    table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        border-collapse: collapse;
        margin: 0.5em 0;
        font-size: 0.93em;

        th, td {
            padding: 4px 8px;
            border: 1px solid var(--black_75);
            text-align: left;
        }

        th {
            background: var(--black_25);
            font-weight: 600;
        }
    }
}

/* ================================================
   COLOR UTILITIES
   ================================================ */

.antimanual-bg-primary,
.antimanual-bg-primary:hover,
.antimanual-bg-primary:focus,
.antimanual-bg-primary-foreground {
  background-color: var(--antimanual_primary_color) !important;
}

.antimanual-text-primary-foreground {
  color: var(--antimanual_white_color);
}

/* ================================================
   RESET & BASE STYLES
   ================================================ */

img.antimanual_icons {
  width: 16px;
}

/* ================================================
   EAZYDOCS INTEGRATION
   ================================================ */

.assistant-content[tab-content="antimanual_merge_eazydocs"] {
  height: 720px;
  #antimanual-chatbox {
    display: block !important;
    position: unset;
    margin: 0;
    height: 100%;
    width: 100%;
  }

  &.active {
    margin: -100px -11px 0 -15px;

    #antimanual-chatbox-inner-wrapper {
      height: calc(100% - 60px);
      position: absolute;
      bottom: 0;
      top: 60px;
      left: 0;
    }

    #antimanual-chatbox-header {
      background-color: var(--bs-white);
      padding: 12px 15px 12px;

      &.atml-empty {
        padding: 8px;

        #atml-chat-reset {
          position: absolute;
          right: 15px;
          top: 0;
          transform: translateY(-100%);
        }
      }
    }

    .antimanual-chatbox-header-actions {
      display: none;
    }
  }

  #antimanual-input-container {
    margin-bottom: 15px;
  }

  #antimanual-chatbox-header-text {
    text-align: left;
  }
}

/* ================================================
   CHATBOX CONTAINER
   ================================================ */

#antimanual-chatbox {
  width: min(400px, calc(100vw - 32px));
  height: min(700px, calc(100vh - 108px));
  margin: 16px 16px 92px 16px;
  position: fixed;
  left: auto;
  right: 0;
  bottom: 0;
  transform: none;
  margin-right: 30px;
  background-color: var(--antimanual_white_color);
  border-radius: 16px;
  box-shadow: rgba(9, 14, 21, 0.16) 0 5px 40px 0;
  overflow: hidden;
  z-index: 10001;
  display: none;
  flex-direction: column;

  &.iframe-wrapper {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
  }

  /* Focus States for Accessibility */
  button:focus-visible {
    outline: 2px solid var(--antimanual_primary_color, #2563eb);
    outline-offset: 2px;
  }
}

/* ================================================
   INNER WRAPPER
   ================================================ */

#antimanual-chatbox-inner-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background-color: var(--bs-white, #fff);
}

/* ================================================
   HEADER
   ================================================ */

#antimanual-chatbox-header {
  justify-self: start;
  background-color: var(--black_25);
  color: var(--black_800);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--black_75);
}

#antimanual-chatbox-header-text {
  color: var(--antimanual_header_text_color, var(--black_800));

  strong {
    font-size: 16px;
    font-weight: 600;
    color: var(--black_800);
  }

  p {
    font-size: 13px;
    margin: 2px 0 0;
    color: var(--black_500);
    line-height: 1.4;
  }
}

#atml-chat-reset,
#atml-chat-close {
  border: none;
  outline: none;
  background: transparent;
  color: var(--black_400);
  padding: 4px;
  cursor: pointer;
  transition: color 0.2s ease;
  border-radius: 6px;

  .antimanual-icon {
    width: 14px;
  }

  &:hover {
    color: var(--black_700);
  }

  &:disabled {
    cursor: not-allowed;
    opacity: 0.5;
  }
}

.antimanual-chatbox-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ================================================
   OFFLINE BANNER
   ================================================ */

.antimanual-offline-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 16px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #78350f;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-bottom: 1px solid rgba(253, 211, 77, 0.5);

  &.show {
    display: flex;
    animation: antimanual-offline-slide-down 0.3s ease-out;
  }

  svg {
    width: 14px;
    height: 14px;
    opacity: 0.8;
    flex-shrink: 0;
  }

  span {
    line-height: 1;
  }

  /* Pulsing status dot */
  &::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d97706;
    flex-shrink: 0;
    animation: antimanual-offline-pulse 2s ease-in-out infinite;
  }
}

@keyframes antimanual-offline-slide-down {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes antimanual-offline-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ================================================
   CHAT AREA
   ================================================ */

.antimanualchatbox {
  flex-grow: 1;
  padding: 16px;
  overflow-y: auto;

  /* Smooth Scrollbar */
  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-track {
    background: transparent;
  }

  &::-webkit-scrollbar-thumb {
    background: var(--black_200, #d1d5db);
    border-radius: 3px;

    &:hover {
      background: var(--black_300, #9ca3af);
    }
  }
}

/* ================================================
   MESSAGES
   ================================================ */

.antimanual-msg {
  display: flex;
  align-items: start;
  margin-bottom: 8px;

  &.bot {
    margin-bottom: 4px;
  }
  &.system {
    position: relative;
    justify-content: center;
    width: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='20' viewBox='0 0 40 20'%3E%3Cpath d='M0 10 Q10 0 20 10 T40 10' stroke='%23aaadaf' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-position: left bottom;
    background-size:8px 22px;

    .msg-content {
      color: var(--black_500) !important;
      padding: 0 4px;
      background-color: #fff;
    }
    &::after{
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      right: 0;
      background: linear-gradient(
        to right,
        #fff 0%,
        transparent 30%,
        transparent 70%,
        #fff 100%
      );
      opacity: 0.9;
    }
  }
  &.loading-message{
    .msg-content {
      background-color: transparent;
      padding: 0;
    }
  }
  .msg-content {
    padding: 8px 12px;
    margin: 0;
    font-size: var(--antimanual_font_size, 14px);
    overflow-x: auto;
    line-height: 1.5;

    &:has(.antimanual-escalation-card) {
      padding: 1px;
    }

    *:first-child {
      margin-top: 0;
    }

    *:last-child {
      margin-bottom: 0;
    }

    pre{
      background-color: #fff;
      margin-bottom: 10px;
    }
  }

  /* Bot Messages */
  &.bot {
    justify-content: start;

    .msg-content {
      border-radius: 16px 16px 16px 4px;
    }
    .bot-profile-icon {
      border-radius: 50%;
      margin-right: 8px;
      width: 28px;
      height: 28px;
    }

    .antimanual-response {
      min-width: 0;
      overflow: hidden;

      .msg-content {
        color: var(--black_900);
        background-color: var(--black_25);
        max-width: unset;
        overflow-wrap: anywhere;
        word-break: break-word;
      }
    }

    &.no-avatar .bot-profile-icon {
      display: none;
    }
  }

  /* User Messages */
  &:last-child:not(.placeholder) {
     &.user {
      animation: antimanual-slide-in-right 0.3s ease-out;
     }
      &.bot {
      animation: antimanual-slide-in-left 0.3s ease-out;
     }
  }
  &.user {
    justify-content: flex-end;
    margin-bottom: 12px;
    .msg-content {
      color: var(--black_900);
      background-color:  color-mix(
        in srgb,
        var(--antimanual_primary_color) 30%,
        transparent
      );
      max-width: 100%;
      border-radius: 16px 4px 16px 16px;
    }

    .antimanual-msg-timestamp {
      display: block;
      margin-top: 4px;
      text-align: right;
      opacity: 0.7;
      line-height: 1;
    }
  }

  /* Placeholder Messages (hidden by default) */
  &.placeholder {
    display: none;
  }

  /* Timestamp (hover to reveal on bot messages) */
  .antimanual-msg-timestamp {
    font-size: 11px;
    color: var(--black_400, #9ca3af);
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
  }

  &:hover .antimanual-msg-timestamp {
    opacity: 1;
  }

  /* Actions (hover to reveal) */
  &:hover .antimanual-msg-actions {
    opacity: 1;
  }

  /* Chat-bubble friendly typography — compact, native chatbot feel.
   Sized in em so it inherits the message's base font-size. */
.atml-msg-html {
    line-height: 1.5;
    color: var(--black_800);
    word-wrap: break-word;
    overflow-wrap: anywhere;

    /* Trim outer whitespace so the bubble hugs the content */
    > *:first-child { margin-top: 0; }
    > *:last-child  { margin-bottom: 0; }

    p {
        margin: 0.45em 0;
    }

    h1, h2, h3, h4, h5, h6 {
        margin: 0.7em 0 0.25em;
        font-weight: 600;
        line-height: 1.3;
        color: var(--black_900);
        border: 0;
        padding: 0;

        &:first-child { margin-top: 0; }
    }

    h1 { font-size: 1.08em; }
    h2 { font-size: 1.05em; }
    h3 { font-size: 1em; color: var(--black_700); }
    h4, h5, h6 { font-size: 0.95em; color: var(--black_700); }

    strong { font-weight: 600; color: var(--black_900); }
    em     { font-style: italic; color: var(--black_700); }

    a {
        color: var(--antimanual_primary_color);
        text-decoration: underline;
        text-decoration-thickness: 1px;
        text-underline-offset: 2px;
        transition: opacity 0.15s ease;
        word-break: break-word;

        &:hover { opacity: 0.75; }
    }

    /* Inline code */
    code {
        background: var(--black_50);
        padding: 1px 5px;
        border-radius: 4px;
        font-family: ui-monospace, "SF Mono", "Fira Code", Menlo, Consolas, monospace;
        font-size: 0.87em;
        color: var(--black_900);
        word-break: break-word;
    }

    /* Block code */
    pre {
        background: var(--black_50);
        padding: 8px 10px;
        margin: 0.5em 0;
        border-radius: 6px;
        font-family: ui-monospace, "SF Mono", "Fira Code", Menlo, Consolas, monospace;
        font-size: 0.85em;
        line-height: 1.45;
        overflow-x: auto;

        code {
            background: transparent;
            padding: 0;
            border-radius: 0;
            font-size: 1em;
            color: inherit;
            white-space: pre;
        }
    }

    img {
        max-width: 100%;
        height: auto;
        border-radius: 6px;
        margin: 0.4em 0;
        display: block;
    }

    /* Lists — tight, no excess indent. padding-left holds bullets inside
       the bubble; margins are minimal. */
    ul, ol {
        margin: 0.35em 0;
        padding-left: 1.25em;
    }

    li {
        margin: 0.12em 0;
        line-height: 1.5;
        color: var(--black_800);

        > p { margin: 0; }

        ul, ol { margin: 0.15em 0; }
    }

    ul { list-style: disc; }
    ol { list-style: decimal; }

    /* Blockquote — soft accent rail, not a heavy quote */
    blockquote {
        margin: 0.5em 0;
        padding: 0.15em 0.75em;
        border-left: 2px solid var(--antimanual_primary_color);
        color: var(--black_600);
        background: transparent;
    }

    /* Horizontal rule — slim divider between thoughts */
    hr {
        border: 0;
        border-top: 1px solid var(--black_75);
        margin: 0.7em 0;
    }

    /* Tables — narrow bubbles can't hold wide tables, so let them scroll */
    table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        border-collapse: collapse;
        margin: 0.5em 0;
        font-size: 0.93em;

        th, td {
            padding: 4px 8px;
            border: 1px solid var(--black_75);
            text-align: left;
        }

        th {
            background: var(--black_25);
            font-weight: 600;
        }
    }
}
}

/* User Message Wrapper */
.antimanual-msg-user-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 85%;
}

.antimanual-live-chat-message-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.antimanual-live-chat-text {
  word-break: break-word;
}

.antimanual-live-chat-attachment {
  display: flex;
  flex-direction: column;
  gap: 6px;

  a {
    display: inline-flex;
    width: fit-content;
    max-width: min(240px, 100%);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: var(--black_25);
  }

  img {
    display: block;
    max-width: 100%;
    max-height: 220px;
    object-fit: cover;
  }
}

.antimanual-live-chat-attachment-name {
  font-size: 11px;
  color: var(--black_600, #d6d9dc);
  word-break: break-all;
}

/* ================================================
   MESSAGE FOOTER (Sources, Actions, Timestamp)
   ================================================ */

.antimanual-msg-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 2px;

  .sources {
    outline: none;
    border: none;
    background: transparent;
    color: var(--black_600, #4b5563);
    padding: 4px 10px;
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover {
      background: var(--black_100, #e5e7eb);
      color: var(--black_800, #1f2937);
    }

    .antimanual-icon.ea-arrow-down {
      width: 10px;
      transition: ease 0.3s transform;
    }

    &.expanded .antimanual-icon.ea-arrow-down {
      transform: rotate(180deg);
    }
  }
}

/* ================================================
   REFERENCES LIST
   ================================================ */

.antimanual-response .references {
  display: none;
  flex-direction: column;
  gap: 5px;
  margin-top: 5px;
  padding: 5px 10px;
  background: var(--black_50, #f9fafb);
  border-radius: 8px;
  border: 1px solid var(--black_100, #e5e7eb);
  width: 100%;

  a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    font-size: 13px;
    color: var(--black_700, #374151);
    transition: all 0.2s ease;
    width: fit-content;

    &:hover {
      color: var(--antimanual_primary_color, #2563eb);
      text-decoration: underline;
      text-underline-offset: 2px;
    }

    .antimanual-icon {
      width: 14px;
      height: 22px;
      color: var(--black_400, #9ca3af);
      flex-shrink: 0;
    }

    .text {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      max-width: 240px;
    }
  }
}

/* ================================================
   MESSAGE ACTIONS (Copy, Feedback)
   ================================================ */

.antimanual-msg-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.antimanual-msg-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: var(--black_50, #f9fafb);
  border-radius: 6px;
  color: var(--black_500, #6b7280);
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    background: var(--black_100, #e5e7eb);
    color: var(--black_700, #374151);
  }

  &.active {
    background: var(--antimanual_primary_color, #2563eb);
    color: #fff;
  }

  svg,
  .antimanual-icon {
    width: 12px;
    height: 12px;
  }
}

/* Copy Tooltip */
.antimanual-copy-tooltip {
  position: absolute;
  background: var(--black_800, #1f2937);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s ease;

  &.show {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Feedback Buttons */
.antimanual-feedback-btns {
  display: flex;
  gap: 4px;
}

.antimanual-feedback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 4px;
  color: var(--black_400, #9ca3af);
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    background: var(--black_100, #e5e7eb);
  }

  &.liked {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
  }

  &.disliked {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
  }

  svg {
    width: 12px;
    height: 12px;
  }
}

/* ================================================
   FOOTER (Suggestions + Input)
   ================================================ */

#antimanual-chatbox-footer {
  justify-self: end;
}

#suggested-questions {
  padding: 10px 16px;
  border-top: 1px solid var(--black_75);

  > p {
    color: var(--black_400);
    font-size: 13px;
    margin-bottom: 8px;
  }

  > button {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    background-color: transparent;
    border: 1px solid var(--black_100);
    border-radius: 20px;
    width: auto;
    display: inline-block;
    margin: 0 4px 6px 0;
    color: var(--antimanual_primary_color);
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover {
      background-color: rgba(0, 102, 204, 0.06);
      border-color: var(--antimanual_primary_color);
    }
  }
}

#antimanual-live-chat-cta {
  padding: 0 16px 12px;
  display: none;
}

#antimanual-live-chat-button {
  position: relative;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--antimanual_primary_color) 8%, #fff) 0%, color-mix(in srgb, var(--antimanual_primary_color) 4%, #fff) 100%);
  color: var(--antimanual_primary_color);
  border: 1px solid color-mix(in srgb, var(--antimanual_primary_color) 22%, transparent);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);

  .antimanual-live-chat-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: var(--antimanual_primary_color);
  }

  .antimanual-live-chat-pulse {
    position: absolute;
    top: -2px;
    right: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 2px #fff;
  }

  .antimanual-live-chat-pulse::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #10b981;
    opacity: 0.6;
    animation: antimanual-live-chat-pulse 1.8s ease-out infinite;
  }

  &:hover:not(:disabled):not(.is-busy) {
    background: linear-gradient(180deg, color-mix(in srgb, var(--antimanual_primary_color) 14%, #fff) 0%, color-mix(in srgb, var(--antimanual_primary_color) 8%, #fff) 100%);
    border-color: color-mix(in srgb, var(--antimanual_primary_color) 38%, transparent);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--antimanual_primary_color) 14%, transparent);
  }

  &:active:not(:disabled):not(.is-busy) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  }

  &:disabled,
  &.is-busy {
    opacity: 0.7;
    cursor: wait;
  }
}

@keyframes antimanual-live-chat-pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

#antimanual-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding:6px 6px 6px 16px;
  margin: 0 16px 16px;
  border: 1px solid var(--black_100, #d1d5db);
  border-radius: 28px;
  transition: border-color 0.2s ease;
}

#antimanual-input-container:focus-within {
  border-color:var(--antimanual_primary_color);
}

.antimanual-input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#antimanual-live-chat-attach {
  display: none;
  padding: 0 !important;
  width: 24px;
  min-width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--black_200);
  cursor: pointer;
  box-shadow: none;
  transition: color 0.2s ease;

  &:hover {
    color: var(--black_600, #4b5563);
  }

  svg {
    width: 20px;
    height: 20px;
  }
  &:disabled {
    display: none !important;
    visibility: hidden;
    opacity: 0;
  }
}

#antimanual-live-chat-attachment-preview {
  display: none;
  padding: 0 14px 10px;
}

.antimanual-live-chat-attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--black_100, #e5e7eb);
  background: #fff;
  border-radius: 8px;

  img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
  }
}

.antimanual-live-chat-attachment-chip-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;

  strong,
  span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  strong {
    font-size: 12px;
    font-weight: 500;
    color: var(--black_800, #1f2937);
  }

  span {
    font-size: 10px;
    color: var(--black_500, #6b7280);
  }
}

.antimanual-live-chat-attachment-remove {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--black_500, #6b7280);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.2s ease, color 0.2s ease;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0px 1px 2px 0px rgba(0,0,0,0.05);

  &:hover {
    background: rgba(15, 23, 42, 0.08);
    color: var(--black_800, #1f2937);
  }
}

#antimanualinput {
  width: 100%;
  padding: 0;
  font-size: 15px;
  color: var(--black_700);
  background-color: transparent;
  border: none;
  border-radius: 0;
  outline: none;
  resize: none;
  overflow-y: auto;
  line-height: auto;
  font-family: inherit;
  scrollbar-width: none;
  box-shadow: none !important;
  
  &::-webkit-scrollbar {
    display: none;
  }

  &::placeholder {
    color: var(--black_400, #9ca3af);
  }
}

#antimanualsend {
  width: 35px;
  min-width: 35px;
  height: 35px;
  padding: 10px;
  border-radius: 50%;
  background-color: var(--antimanual_primary_color);
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  color: var(--antimanual_white_color);
  cursor: pointer;
  transition: color 0.2s ease;
  flex-shrink: 0;

  &:hover:not(:disabled) {
    transform: none;
    opacity: 1;
  }

  &:active:not(:disabled) {
    transform: scale(0.95);
  }

  &:disabled {
    opacity: 0.5;
    cursor: default;
    color: #cbd5e1;
  }
  
  svg {
    width: 20px;
    height: 20px;
  }
}

/* Character Counter */
.antimanual-char-counter {
  position: absolute;
  right: 70px;
  bottom: 20px;
  font-size: 12px;
  color: var(--black_500, #6b7280);
  pointer-events: none;
  transition: color 0.2s ease;

  &.warning {
    color: #f59e0b;
  }

  &.limit {
    color: #ef4444;
  }
}

/* ================================================
   HELP BUTTON
   ================================================ */

button#antimanual-help-button {
  position: fixed;
  right: 25px;
  bottom: 25px;
  background-color: var(--antimanual_primary_color);
  color: var(--antimanual_white_color);
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  box-shadow: rgba(9, 14, 21, 0.16) 0 5px 40px 0;
  z-index: 9999;
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;

  div {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
  }

  #help-icon .antimanual-icon {
    width: 18px;
  }

  #close-icon {
    display: none;

    .antimanual-icon {
      width: 16px;
    }
  }

  /* Hide text label by default for icon-only style */
  .antimanual-help-btn-label {
    display: none !important;
  }

  &:hover {
    transform: scale(1.08);
    box-shadow: rgba(9, 14, 21, 0.22) 0 8px 50px 0;
  }

  &:active {
    transform: scale(0.95);
  }

  &.pulse {
    animation: antimanual-pulse 2s infinite;
  }
}

button#antimanual-help-button-sm {
  display: flex;
  background: var(--black_700);
  position: fixed;
  top: -30px;
  right: 4px;
  border: none;
  outline: none;
  border-radius: 50px;
  padding: 4px 8px;
  color: var(--black_150);
  align-items: center;
  gap: 4px;
  font-size: 12px;
  transition: top 0.3s ease;
  z-index: 999;
  line-height: 0;

  .antimanual_arrow_down_icon {
    width: 12px;
  }
}

/* ================================================
   TYPING INDICATOR
   ================================================ */

.antimanual-typing-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #f5f7fb 0%, #eef2ff 100%);
  border-radius: 16px 16px 16px 4px;
  width: fit-content;
  overflow: hidden;
  font-size: 13px;
  color: var(--black_600);
  line-height: 1.2;

  /* Sweeping shimmer band — gives the pill a soft "alive" feel */
  .atml-thinking-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      100deg,
      transparent 20%,
      rgba(99, 102, 241, 0.12) 50%,
      transparent 80%
    );
    transform: translateX(-100%);
    animation: atml-thinking-shimmer 2.4s ease-in-out infinite;
    pointer-events: none;
  }

  /* Stacked phrase carousel — each child fades in on its own slice of the
     timeline so the same height stays reserved (no jumping). */
  .atml-thinking-text {
    position: relative;
    display: inline-block;
    height: 1.2em;
    min-width: 9.5em;
    overflow: hidden;
    font-weight: 500;

    > span {
      position: absolute;
      inset: 0;
      opacity: 0;
      transform: translateY(6px);
      animation: atml-thinking-phrase 7.2s infinite;
      background: linear-gradient(90deg, var(--antimanual_primary_color, #2563eb), #818cf8);
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
      white-space: nowrap;

      &:nth-child(1) { animation-delay: 0s; }
      &:nth-child(2) { animation-delay: 1.8s; }
      &:nth-child(3) { animation-delay: 3.6s; }
      &:nth-child(4) { animation-delay: 5.4s; }
    }
  }

  /* Trailing dot trio — small, bouncy, matches the verb */
  .atml-thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 2px;

    i {
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: var(--antimanual_primary_color, #6366f1);
      animation: atml-thinking-bounce 1.2s ease-in-out infinite;

      &:nth-child(1) { animation-delay: 0s; }
      &:nth-child(2) { animation-delay: 0.15s; }
      &:nth-child(3) { animation-delay: 0.3s; }
    }
  }
}

@keyframes atml-thinking-shimmer {
  0%   { transform: translateX(-100%); }
  60%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

@keyframes atml-thinking-phrase {
  0%, 2%     { opacity: 0; transform: translateY(6px); }
  6%, 22%    { opacity: 1; transform: translateY(0); }
  26%, 100%  { opacity: 0; transform: translateY(-6px); }
}

@keyframes atml-thinking-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40%           { transform: translateY(-4px); opacity: 1; }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .antimanual-typing-indicator {
    .atml-thinking-shimmer,
    .atml-thinking-text > span,
    .atml-thinking-dots i { animation: none; }
    .atml-thinking-text > span:first-child { opacity: 1; transform: none; }
    .atml-thinking-dots i { opacity: 0.7; }
  }
}

/* Loading Dots (legacy) */
.antimanual-loading-dots {
  display: inline-block;
  margin: 0;
}

.antimanual-dot {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
  width: 12px;
  height: 12px;
  background-color: var(--black_400);
  border-radius: 50%;
  opacity: 0;
  animation: antimanual-dot-blink 1s infinite ease-in-out;

  &:nth-child(1) { animation-delay: 0s; }
  &:nth-child(2) { animation-delay: 0.33s; }
  &:nth-child(3) { animation-delay: 0.66s; }
}

/* ================================================
   LEAD COLLECTION FORM
   ================================================ */

.antimanual-lead-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: var(--bs-white);
  border-radius: 12px;
  margin-top: 20px;
  border: 1px solid var(--black_75);

  .lead-prompt {
    font-size: 14px;
    color: var(--black_700);
    margin: 0;
    line-height: 1.5;
    text-align: center;
  }

  .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .form-group--floating {
    position: relative;

    input {
      padding-top: 14px;
      padding-bottom: 14px;
    }

    label {
      position: absolute;
      top: 50%;
      left: 14px;
      transform: translateY(-50%);
      font-size: 14px;
      color: var(--black_700);
      pointer-events: none;
      background: transparent;
      padding: 0 4px;
      transition: top 0.15s ease, font-size 0.15s ease, color 0.15s ease, transform 0.15s ease;
    }

    input:focus + label,
    input:not(:placeholder-shown) + label {
      top: 0;
      transform: translateY(-50%) scale(0.85);
      transform-origin: left center;
      background: var(--bs-white);
      color: var(--antimanual_primary_color);
    }
  }

  input {
    padding: 12px 14px;
    border: 1px solid var(--black_100);
    border-radius: 10px;
    font-size: 14px;
    width: 100%;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;

    &:focus {
      border-color: var(--antimanual_primary_color);
    }
  }

  .lead-submit-btn {
    padding: 12px 16px;
    background: var(--antimanual_primary_color);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 8px;

    &:hover {
      opacity: 0.9;
    }

    &:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }
  }
}

/* Footer hidden state — used when lead form is active. */
.antimanual-footer-hidden {
  display: none !important;
}

/* ================================================
   ERROR STATE
   ================================================ */

.antimanual-error-msg {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.antimanual-error-text {
  color: var(--black_600, #4b5563);
}

.antimanual-retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--black_200, #d1d5db);
  background: #fff;
  border-radius: 6px;
  color: var(--black_700, #374151);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: fit-content;

  &:hover {
    border-color: var(--antimanual_primary_color, #2563eb);
    background-color: var(--antimanual_primary_color, #2563eb);
    color: #fff;
  }

  svg {
    width: 14px;
    height: 14px;
  }
}

/* ================================================
   TOAST NOTIFICATIONS
   ================================================ */

.antimanual-toast {
  position: fixed;
  bottom: 120px;
  right: 30px;
  padding: 12px 20px;
  background: var(--black_800);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;

  &.show {
    opacity: 1;
    transform: translateY(0);
  }
}

.antimanual-toast-success { background: #10b981; }
.antimanual-toast-error { background: #ef4444; }
.antimanual-toast-info { background: #3b82f6; }

/* ================================================
   ESCALATION / HUMAN HANDOFF CARD
   ================================================ */

.antimanual-escalation-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 16px 16px 16px 4px;
  border: 1px solid #fbbf24;

  p {
    margin: 0;
    font-size: 13px;
    color: #92400e;
    line-height: 1.5;
  }
}

.antimanual-escalation-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  width: fit-content;

  &:hover {
    background: #d97706;
    color: #fff;
  }
}
.antimanual-escalation-offline {
  font-size: 12px;
  color: #92400e;
  font-style: italic;
}

/* ================================================
   LIVE CHAT STATUS INDICATORS
   ================================================ */

.antimanual-live-chat-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;

  &.waiting, &.ended, &.system {
    justify-content: center;
    color: var(--black_400);
    font-style: italic;
  }

  &.error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    border: 1px solid #f87171;
  }
}

.antimanual-live-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: fit-content;

  &:hover {
    background: #059669;
  }
}

#antimanual-live-chat-indicator {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.08);
  border-radius: 999px;
  padding: 4px 12px 4px 8px;
  animation: antimanual-fade-in 0.3s ease;

  &::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
    animation: antimanual-live-dot-pulse 2s ease-in-out infinite;
  }

  span {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--black_600);
    line-height: 1;
  }
}

.antimanual-end-live-chat {
  border: 1px solid var(--black_150);
  border-radius: 999px;
  padding: 3px 10px;
  background: transparent;
  color: var(--black_500);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.15s ease, border-color 0.2s ease;
  line-height: 1.4;

  &:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #f87171;
    color: #ef4444;
  }

  &:active {
    background: rgba(239, 68, 68, 0.15);
    transform: scale(0.96);
  }
}

@keyframes antimanual-live-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  50% { box-shadow: 0 0 0 4px rgba(52, 211, 153, 0); }
}

@keyframes antimanual-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================================================
   ANIMATIONS
   ================================================ */

@keyframes antimanual-slide-in-left {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes antimanual-slide-in-right {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes antimanual-dot-blink {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

@keyframes antimanual-typing-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes antimanual-pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  70% { box-shadow: 0 0 0 15px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* ================================================
   DESKTOP POSITION: BOTTOM LEFT
   ================================================ */

@media screen and (min-width: 769px) {
  body.antimanual-desktop-bottom-left {
    button#antimanual-help-button {
      left: 25px;
      right: auto;
    }

    #antimanual-chatbox {
      left: 16px;
      right: auto;
    }
  }
}

/* ================================================
   TABLET (max-width: 768px)
   ================================================ */

@media screen and (max-width: 768px) {
  body.antimanual-mobile-hidden {
    button#antimanual-help-button,
    button#antimanual-help-button-sm,
    #antimanual-chatbox {
      display: none !important;
    }
  }

  body.antimanual-mobile-bottom-left {
    button#antimanual-help-button {
      left: 25px;
      right: auto;
    }

    #antimanual-chatbox {
      left: 16px;
      right: auto;
    }
  }

  body.antimanual-mobile-bottom-center {
    button#antimanual-help-button {
      left: 50%;
      right: auto;
      transform: translateX(-50%);
    }

    #antimanual-chatbox {
      left: 50%;
      right: auto;
      transform: translateX(-50%);
    }
  }
}

/* ================================================
   MOBILE (max-width: 600px)
   ================================================ */

@media screen and (max-width: 600px) {
  #antimanual-chatbox {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    transform: none !important;

    #antimanual-chatbox-header {
      padding: 14px 16px;
    }

    #antimanual-chatbox-header-text {
      strong { font-size: 15px; }
      p { font-size: 12px; }
    }

    #suggested-questions > button {
      font-size: 13px;
      padding: 8px 14px;
    }

    #antimanualinput {
      font-size: 16px;
    }
  }

  body.antimanual_chatbox_expanded {
    button#antimanual-help-button {
      display: none !important;
    }

    button#antimanual-help-button-sm {
      display: none !important;
    }
  }

  body.admin-bar.antimanual_chatbox_expanded button#antimanual-help-button-sm {
    display: none !important;
  }

  body.antimanual-mobile-bottom-left #antimanual-chatbox,
  body.antimanual-mobile-bottom-center #antimanual-chatbox {
    left: 0 !important;
    transform: none !important;
  }

  .antimanual-msg-actions,
  .antimanual-msg-timestamp {
    opacity: 1;
  }

  .antimanual-char-counter {
    right: 60px;
    bottom: 16px;
  }

  .antimanual-toast {
    left: 16px;
    right: 16px;
    bottom: 80px;
  }
}

/* Hide the native file input, only show the icon button */
#antimanual-live-chat-file {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}
