/*
 * Shared chat component.
 *
 * This is intentionally under assets/css/components because the same chat UI is
 * used by the floating chat widget across the app. Page-specific CSS
 * files should not own this shared component.
 */

.chat-unread-badge,
.chat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  vertical-align: middle;
}

.chat-unread-badge.is-hidden,
.chat-badge.is-hidden {
  display: none !important;
}

.chat-toggle .chat-badge {
  position: absolute;
  top: -7px;
  right: -10px;
}

.chat-unread-badge.is-blinking,
.chat-badge.is-blinking {
  animation: chat-unread-blink 1s steps(1, end) infinite;
}

@keyframes chat-unread-blink {
  0%, 49% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0.2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-unread-badge.is-blinking,
  .chat-badge.is-blinking {
    animation: none;
  }
}

.chat-widget {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1055;
  width: 340px;
  max-width: calc(100vw - 32px);
  font-family: inherit;
}

.chat-toggle-wrap {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
}

.chat-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 999px;
  opacity: 1;
}

.chat-toggle-btn {
  background: transparent;
  border: 0;
  color: #0d6efd;
  box-shadow: none;
}

.chat-toggle-btn:hover {
  background: transparent;
  color: #3d8bfd;
}

.chat-toggle-btn:focus-visible {
  outline: 2px solid rgba(13, 110, 253, 0.45);
  outline-offset: 3px;
}

.chat-toggle-inner {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chat-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-toggle-icon svg {
  width: 36px;
  height: 36px;
  display: block;
  fill: currentColor;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.28));
}

.chat-toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: min(640px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  background: #111;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.chat-widget.is-open .chat-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.chat-widget.is-open .chat-toggle-wrap {
  visibility: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
}

.chat-title {
  font-weight: 600;
}

.chat-messages {
  overflow: auto;
  background: rgba(0, 0, 0, 0.10);
}

.chat-messages {
  height: auto;
  flex: 1 1 auto;
  padding: 10px 12px;
}

.chat-empty {
  padding: 8px 0;
}

.chat-message {
  position: relative;
  padding: 8px 44px 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  margin-bottom: 8px;
}

.chat-message.is-deleted {
  background: rgba(255, 255, 255, 0.03);
  opacity: 0.9;
}

.chat-message.is-deleted .chat-body {
  font-style: italic;
  opacity: 0.85;
}

.chat-message.is-deleted .chat-delete-btn {
  display: none;
}

.chat-meta {
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-body {
  font-size: 13px;
  line-height: 1.25;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
}

.chat-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
}

.chat-delete-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  opacity: 0.95;
}

.chat-delete-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.chat-form {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
}

.chat-input {
  font-size: 13px;
  resize: none;
}

.chat-input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.chat-input-row .chat-input {
  flex: 1 1 auto;
}

.chat-actions {
  margin-top: 6px;
}

.chat-status {
  min-height: 1.2em;
}

.chat-body-lock {
  position: fixed;
  width: 100%;
  overflow: hidden;
}


@media (max-width: 575.98px) {
  .chat-widget {
    right: 0;
    bottom: 22vh;
    width: min(340px, calc(100vw - 12px));
    max-width: calc(100vw - 12px);
  }

  .chat-panel {
    position: fixed;
    left: 6px;
    right: 6px;
    top: calc(6px + var(--vvo, 0px));
    bottom: calc(6px + var(--kb, 0px));
    width: auto;
    max-width: none;
    max-height: none;
    display: flex;
    flex-direction: column;
    transform: translateZ(0);
  }

  .chat-messages {
    height: auto;
    flex: 1 1 auto;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .chat-form {
    flex: 0 0 auto;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .chat-toggle-wrap {
    right: 0;
    bottom: 0;
    transform: rotate(-90deg);
    transform-origin: right bottom;
  }

  .chat-toggle {
    width: auto;
    height: auto;
    border-radius: 10px 10px 0 0;
    padding: 10px 12px;
  }

  .chat-toggle-btn {
    background: rgba(66, 70, 73, 0.55);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    border-right: none;
    border-bottom: none;
    color: #fff;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22);
  }

  .chat-toggle-icon {
    display: none;
  }

  .chat-toggle-label {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .chat-toggle .chat-badge {
    position: static;
    margin-left: 8px;
  }

  .chat-input {
    font-size: 16px;
    padding: 8px 10px;
  }

  .chat-input-row {
    position: relative;
  }

  .chat-input-row .chat-input {
    width: 100%;
    padding-right: 44px;
  }

  .chat-send-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    transform: translateY(-50%);
  }
}

.chat-form {
  position: relative;
}

.chat-mention-popover {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% - 4px);
  z-index: 1080;
  max-height: 240px;
  overflow: auto;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(24, 24, 24, 0.96);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  color: #fff;
}

.chat-mention-popover.is-hidden {
  display: none;
}

.chat-mention-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.chat-mention-option:hover,
.chat-mention-option.is-active {
  background: rgba(13, 110, 253, 0.28);
}

.chat-mention-option.is-empty {
  cursor: default;
  justify-content: center;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.875rem;
  padding: 10px 12px;
}

.chat-mention-option.is-empty:hover {
  background: transparent;
}

.chat-mention-option-avatar {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(13, 110, 253, 0.55);
  font-weight: 700;
  font-size: 12px;
  flex: 0 0 auto;
}

.chat-mention-option-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-mention {
  display: inline;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: rgba(13, 110, 253, 0.16);
  color: #8bb9ff;
  font-weight: 700;
}

.chat-mention.is-me {
  background: rgba(220, 53, 69, 0.92);
  color: #fff;
}

.chat-message.is-mentioned-target {
  animation: chat-mentioned-target-pulse 1.2s ease-in-out 0s 3;
  border-color: rgba(255, 193, 7, 0.75);
}

@keyframes chat-mentioned-target-pulse {
  0%, 100% {
    box-shadow: 0 0 0 rgba(255, 193, 7, 0);
  }
  50% {
    box-shadow: 0 0 0 0.22rem rgba(255, 193, 7, 0.28);
  }
}

.chat-mention-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(220, 53, 69, 0.28);
  background:
    linear-gradient(135deg, rgba(220, 53, 69, 0.16), rgba(13, 110, 253, 0.10)),
    rgba(20, 20, 20, 0.18);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
}

.chat-mention-notice.is-hidden {
  display: none;
}

.chat-mention-notice.is-entering {
  animation: chat-mention-notice-in 0.32s ease-out;
}

.chat-mention-notice.is-leaving {
  animation: chat-mention-notice-out 0.24s ease-in forwards;
}

@keyframes chat-mention-notice-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chat-mention-notice-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.chat-mention-notice-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-weight: 800;
  flex: 0 0 auto;
}

.chat-mention-notice-body {
  min-width: 0;
  flex: 1 1 auto;
}

.chat-mention-notice-title {
  font-weight: 700;
  line-height: 1.2;
}

.chat-mention-notice-preview {
  margin-top: 2px;
  font-size: 0.875rem;
  opacity: 0.86;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


@media (max-width: 575.98px) {
  .chat-mention-notice {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-message.is-mentioned-target,
  .chat-mention-notice.is-entering,
  .chat-mention-notice.is-leaving {
    animation: none;
  }
}

/* BEGIN chat-send-button-v1
   Keep the widget composer aligned with the chat: textarea on the left,
   transparent icon button on the right, and keyboard-friendly overlay only on
   extra-small screens. */
.chat-input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.chat-input-row .chat-input {
  flex: 1 1 auto;
  min-width: 0;
}

.chat-send-btn {
  flex: 0 0 38px;
  width: 38px;
  min-width: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #0d6efd;
  cursor: pointer;
}

.chat-send-btn .bi,
.chat-send-btn .chat-send-icon {
  width: 18px;
  height: 18px;
  font-size: 18px;
  line-height: 1;
  display: block;
  fill: currentColor;
}

.chat-send-btn:hover {
  background: transparent !important;
  border: none !important;
  color: #3d8bfd;
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-send-btn:focus,
.chat-send-btn:focus-visible {
  outline: none;
  box-shadow: none !important;
}

.chat-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 8px;
}

.chat-status {
  min-height: 18px;
}

@media (max-width: 575.98px) {
  .chat-input-row {
    position: relative;
  }

  .chat-input-row .chat-input {
    width: 100%;
    padding-right: 44px;
  }

  .chat-send-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    flex: 0 0 36px;
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    transform: translateY(-50%);
  }

  .chat-send-btn:active {
    transform: translateY(-50%) scale(0.95);
  }
}
/* END chat-send-button-v1 */

/* Chat mention notice layout polish: header row + cleaner preview spacing. */
.chat-mention-notice {
  display: block;
}

.chat-mention-notice-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.chat-mention-notice-kicker {
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.chat-mention-notice-body {
  display: block;
  min-width: 0;
}

.chat-mention-notice-title {
  margin: 0;
}

.chat-mention-notice-preview {
  margin-top: 8px;
}

@media (max-width: 575.98px) {
  .chat-mention-notice {
    display: block;
  }
}

/* Chat toggle and send-button layout.
   - >= md: render the labelled floating chat control.
   - Chat form: use the paper-plane icon as the send button.
*/
@media (min-width: 768px) {
  .chat-toggle {
    width: auto;
    height: auto;
    border-radius: 10px;
    padding: 10px 12px;
  }

  .chat-toggle-btn {
    background: rgba(66, 70, 73, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22);
  }

  .chat-toggle-btn:hover {
    background: rgba(66, 70, 73, 0.70);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
  }

  .chat-toggle-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.35);
    outline-offset: 2px;
  }

  .chat-toggle-inner {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    line-height: 1;
  }

  .chat-toggle-icon {
    display: none !important;
  }

  .chat-toggle-label {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
    border: 0;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .chat-toggle .chat-badge {
    position: static;
    margin-left: 8px;
  }
}

.chat-send-btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: 38px;
  min-width: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0d6efd;
  cursor: pointer;
}

.chat-send-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chat-send-icon svg {
  display: block;
  width: 32px;
  height: 32px;
  fill: currentColor;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.24));
}

.chat-send-btn:hover {
  background: transparent !important;
  border: none !important;
  color: #3d8bfd;
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-send-btn:focus,
.chat-send-btn:focus-visible {
  outline: none;
  box-shadow: none !important;
}

@media (max-width: 575.98px) {
  .chat-send-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    transform: translateY(-50%);
  }

  .chat-send-btn:active {
    transform: translateY(-50%) scale(0.95);
  }
}
/* End chat toggle and send-button layout. */

/* Final chat notice and toggle sizing overrides.
   Keep this block last so these component-level values win the cascade. */
.chat-widget {
  --chat-toggle-button-size: 54px;
  --chat-toggle-bubble-icon-size: 31px;
}

@media (min-width: 768px) {
  .chat-widget {
    --chat-toggle-button-size: 62px;
    --chat-toggle-bubble-icon-size: 36px;
  }
}

.chat-toggle {
  width: var(--chat-toggle-button-size) !important;
  height: var(--chat-toggle-button-size) !important;
  padding: 0 !important;
  border-radius: 999px !important;
}

.chat-toggle-btn {
  background: rgba(10, 14, 24, 0.42) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.88) !important;
  color: #fff !important;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.26) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chat-toggle-btn:hover {
  background: rgba(10, 14, 24, 0.58) !important;
  border-color: #fff !important;
  color: #fff !important;
}

.chat-toggle-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55) !important;
  outline-offset: 3px !important;
}

.chat-toggle-inner {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
}

.chat-toggle-icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  transform: none !important;
}

.chat-toggle-icon svg {
  width: var(--chat-toggle-bubble-icon-size) !important;
  height: var(--chat-toggle-bubble-icon-size) !important;
  display: block;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.28));
}

.chat-toggle-icon svg path {
  fill: none !important;
  stroke: currentColor !important;
}

.chat-toggle-label {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.chat-toggle .chat-badge {
  position: absolute !important;
  top: -7px !important;
  right: -8px !important;
  margin: 0 !important;
}

@media (max-width: 575.98px) {
  .chat-toggle-wrap {
    transform: none !important;
    right: 8px !important;
    bottom: 0 !important;
  }

  .chat-toggle {
    width: var(--chat-toggle-button-size) !important;
    height: var(--chat-toggle-button-size) !important;
    border-radius: 999px !important;
    padding: 0 !important;
  }

  .chat-toggle-btn {
    border: 1.5px solid rgba(255, 255, 255, 0.88) !important;
  }
}

.chat-send-btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #0d6efd !important;
}

.chat-send-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chat-send-icon svg {
  display: block;
  width: 32px;
  height: 32px;
  fill: currentColor;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.24));
}

.chat-send-btn:hover {
  background: transparent !important;
  border: none !important;
  color: #3d8bfd !important;
}

.chat-mention-notice {
  display: block;
  overflow: hidden;
}

.chat-mention-notice-body {
  display: block;
  min-width: 0;
}

.chat-mention-notice-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.chat-mention-notice-icon {
  width: 38px;
  height: 38px;
  font-size: 16px;
}

.chat-mention-notice-title {
  margin: 0;
  color: #fff;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.01em;
}

.chat-mention-notice-message {
  margin-top: 0;
  font-weight: 800;
  line-height: 1.25;
}

.chat-mention-notice-preview {
  margin-top: 10px;
  max-width: 100%;
  font-size: 0.875rem;
  opacity: 0.86;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* END chat-notice-bubble-recovery-v3 */

/* CHAT MENTION NOTICE FINAL V2 START */
.chat-mention-notice {
  align-items: stretch !important;
  background:
    linear-gradient(135deg, rgba(220, 38, 38, 0.34), rgba(244, 63, 94, 0.16)),
    rgba(15, 23, 42, 0.78) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: 0 0.85rem 2rem rgba(0, 0, 0, 0.16) !important;
  color: #fee2e2 !important;
  display: block !important;
  gap: 0 !important;
  margin-bottom: 16px;
  max-width: 100%;
  overflow: hidden;
  padding: 0.95rem 1.1rem 0.95rem 1.35rem !important;
  position: relative;
}

.chat-mention-notice::before {
  background: #ef4444;
  content: "";
  inset: 0 auto 0 0;
  position: absolute;
  width: 0.38rem;
}

.chat-mention-notice.is-hidden {
  display: none !important;
}

.chat-mention-notice-head,
.chat-mention-notice-icon,
.chat-mention-notice-title {
  display: none !important;
}

.chat-mention-notice-body {
  display: block !important;
  min-width: 0;
}

.chat-mention-notice-message {
  color: #fff1f2 !important;
  font-size: 0.96rem;
  font-weight: 800;
  line-height: 1.35;
  margin: 0 0 0.45rem !important;
}

.chat-mention-notice-preview {
  color: rgba(255, 241, 242, 0.92) !important;
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 !important;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal !important;
}
/* CHAT MENTION NOTICE FINAL V2 END */

/* CHAT TOGGLE NOTICE FINAL V1 START */
.chat-widget {
  --chat-toggle-bg: rgba(66, 70, 73, 0.55);
  --chat-toggle-bg-hover: rgba(66, 70, 73, 0.70);
  --chat-toggle-border: rgba(255, 255, 255, 0.18);
  --chat-toggle-border-hover: rgba(255, 255, 255, 0.22);
  --chat-toggle-radius: 10px;
  --chat-toggle-padding-y: 10px;
  --chat-toggle-padding-x: 12px;
  --chat-toggle-gap: 10px;
  --chat-send-button-size: 36px;
  --chat-send-button-right: 14px;
}

.chat-toggle-wrap {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
}

.chat-toggle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  height: auto !important;
  padding: var(--chat-toggle-padding-y) var(--chat-toggle-padding-x) !important;
  border-radius: var(--chat-toggle-radius) !important;
  opacity: 1 !important;
}

.chat-toggle-btn {
  background: var(--chat-toggle-bg) !important;
  border: 1px solid var(--chat-toggle-border) !important;
  color: #fff !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chat-toggle-btn:hover {
  background: var(--chat-toggle-bg-hover) !important;
  border-color: var(--chat-toggle-border-hover) !important;
  color: #fff !important;
}

.chat-toggle-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35) !important;
  outline-offset: 2px;
}

.chat-toggle-inner {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--chat-toggle-gap);
  line-height: 1;
}

.chat-toggle-icon {
  display: none !important;
}

.chat-toggle-label {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: nowrap !important;
  border: 0 !important;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.chat-toggle .chat-badge {
  position: static !important;
  margin-left: 8px;
}

.chat-toggle .chat-badge.is-hidden {
  display: inline-flex !important;
  visibility: hidden;
  opacity: 0;
}

.chat-widget.is-open .chat-toggle-wrap {
  pointer-events: none;
  visibility: hidden;
}

.chat-input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.chat-input-row .chat-input {
  flex: 1 1 auto;
}

.chat-send-btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: 38px;
  min-width: 38px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0d6efd !important;
  cursor: pointer;
}

.chat-send-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chat-send-icon svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.chat-send-btn:hover {
  background: transparent !important;
  border: none !important;
  color: #3d8bfd !important;
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-send-btn:focus,
.chat-send-btn:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.chat-mention-notice-body {
  min-width: 0;
}

.chat-mention-notice-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.chat-mention-notice-title {
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 800;
}

.chat-mention-notice-message {
  margin-top: 0;
  margin-bottom: 8px;
}

.chat-mention-notice-preview {
  display: block;
  max-width: 100%;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.35;
}

@media (max-width: 575.98px) {
  .chat-widget {
    right: 0;
    bottom: 22vh;
    width: min(340px, calc(100vw - 12px));
    max-width: calc(100vw - 12px);
  }

  .chat-toggle-wrap {
    right: 0;
    bottom: 0;
    transform: rotate(-90deg);
    transform-origin: right bottom;
  }

  .chat-toggle {
    width: auto !important;
    height: auto !important;
    padding: var(--chat-toggle-padding-y) var(--chat-toggle-padding-x) !important;
    border-radius: 10px 10px 0 0 !important;
  }

  .chat-toggle-btn {
    background: var(--chat-toggle-bg) !important;
    border-top: 1px solid var(--chat-toggle-border) !important;
    border-left: 1px solid var(--chat-toggle-border) !important;
    border-right: none !important;
    border-bottom: none !important;
    color: #fff !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .chat-toggle-btn:hover {
    background: var(--chat-toggle-bg-hover) !important;
    color: #fff !important;
  }

  .chat-input-row {
    position: relative;
  }

  .chat-input-row .chat-input {
    width: 100%;
    padding-right: 56px;
  }

  .chat-send-btn {
    position: absolute;
    right: var(--chat-send-button-right);
    top: 50%;
    width: var(--chat-send-button-size);
    min-width: var(--chat-send-button-size);
    height: var(--chat-send-button-size);
    transform: translateY(-50%);
  }

  .chat-send-btn:active {
    transform: translateY(-50%) scale(0.95);
  }
}
/* CHAT TOGGLE NOTICE FINAL V1 END */
/* CHAT MOBILE SIDE TAB V1 START */
@media (max-width: 575.98px) {
  .chat-widget {
    right: 0 !important;
    bottom: 22vh !important;
    width: min(340px, calc(100vw - 12px)) !important;
    max-width: calc(100vw - 12px) !important;
  }

  .chat-toggle-wrap {
    right: 0 !important;
    bottom: 0 !important;
    transform: rotate(-90deg) !important;
    transform-origin: right bottom !important;
  }

  .chat-toggle {
    width: auto !important;
    height: auto !important;
    padding: 10px 12px !important;
    border-radius: 10px 10px 0 0 !important;
  }

  .chat-toggle-btn {
    background: rgba(66, 70, 73, 0.55) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-right: none !important;
    border-bottom: none !important;
    color: #fff !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22) !important;
  }

  .chat-toggle-icon {
    display: none !important;
  }

  .chat-toggle-label {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: nowrap !important;
    border: 0 !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
  }

  .chat-toggle .chat-badge {
    position: static !important;
    margin-left: 8px !important;
  }
}
/* CHAT MOBILE SIDE TAB V1 END */

/* CHAT MENTION NOTICE FINAL ORDER GUARD V2 START */
.chat-mention-notice {
  background:
    linear-gradient(135deg, rgba(220, 38, 38, 0.34), rgba(244, 63, 94, 0.16)),
    rgba(15, 23, 42, 0.78) !important;
  border: 0 !important;
  border-radius: 0 !important;
  display: block !important;
  overflow: hidden;
  padding: 0.95rem 1.1rem 0.95rem 1.35rem !important;
  position: relative;
}

.chat-mention-notice::before {
  background: #ef4444;
  content: "";
  inset: 0 auto 0 0;
  position: absolute;
  width: 0.38rem;
}

.chat-mention-notice-head,
.chat-mention-notice-icon,
.chat-mention-notice-title {
  display: none !important;
}

.chat-mention-notice-message {
  color: #fff1f2 !important;
  font-weight: 800;
  line-height: 1.35;
  margin: 0 0 0.45rem !important;
}

.chat-mention-notice-preview {
  color: rgba(255, 241, 242, 0.92) !important;
  line-height: 1.45;
  margin: 0 !important;
  overflow-wrap: anywhere;
  white-space: normal !important;
}
/* CHAT MENTION NOTICE FINAL ORDER GUARD V2 END */

/* Chat blue-gradient visual theme.
   This layer changes only visual presentation. It intentionally does not alter
   widget dimensions, positioning, spacing, or interaction behavior. */
.chat-widget {
  --chat-theme-surface-deep: rgba(7, 14, 25, 0.98);
  --chat-theme-surface-mid: rgba(17, 27, 42, 0.96);
  --chat-theme-surface-soft: rgba(29, 41, 57, 0.94);
  --chat-theme-blue-strong: rgba(37, 99, 235, 0.34);
  --chat-theme-blue-medium: rgba(59, 130, 246, 0.20);
  --chat-theme-blue-soft: rgba(14, 165, 233, 0.10);
  --chat-theme-line: rgba(125, 188, 255, 0.24);
  --chat-theme-line-soft: rgba(147, 197, 253, 0.13);
  --chat-theme-text: rgba(248, 251, 255, 0.98);
  --chat-theme-text-soft: rgba(219, 234, 254, 0.72);
}

.chat-panel {
  background:
    radial-gradient(circle at 8% -8%, rgba(59, 130, 246, 0.34), transparent 30%),
    radial-gradient(circle at 96% 12%, rgba(14, 165, 233, 0.17), transparent 28%),
    linear-gradient(155deg, var(--chat-theme-surface-mid) 0%, var(--chat-theme-surface-soft) 44%, var(--chat-theme-surface-deep) 100%);
  border-color: var(--chat-theme-line);
  box-shadow:
    0 26px 72px rgba(2, 6, 23, 0.58),
    0 0 0 1px rgba(255, 255, 255, 0.035) inset,
    0 0 54px rgba(37, 99, 235, 0.12);
}

.chat-header {
  background:
    linear-gradient(125deg, rgba(37, 99, 235, 0.32), rgba(59, 130, 246, 0.13) 48%, rgba(14, 165, 233, 0.06) 100%),
    rgba(15, 23, 42, 0.78);
  border-bottom-color: var(--chat-theme-line-soft);
  box-shadow:
    0 10px 28px rgba(2, 6, 23, 0.20),
    0 -1px 0 rgba(147, 197, 253, 0.16) inset;
  backdrop-filter: blur(14px) saturate(125%);
  -webkit-backdrop-filter: blur(14px) saturate(125%);
}

.chat-title {
  color: var(--chat-theme-text);
  text-shadow:
    0 1px 14px rgba(96, 165, 250, 0.22),
    0 0 28px rgba(37, 99, 235, 0.10);
}

.chat-header .btn-outline-light {
  color: rgba(239, 246, 255, 0.92);
  background:
    linear-gradient(145deg, rgba(59, 130, 246, 0.12), rgba(15, 23, 42, 0.22)),
    rgba(15, 23, 42, 0.34);
  border-color: rgba(191, 219, 254, 0.24);
  box-shadow:
    0 6px 18px rgba(2, 6, 23, 0.16),
    0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.chat-header .btn-outline-light:hover,
.chat-header .btn-outline-light:focus-visible {
  color: #fff;
  background:
    linear-gradient(145deg, rgba(59, 130, 246, 0.28), rgba(14, 165, 233, 0.10)),
    rgba(15, 23, 42, 0.46);
  border-color: rgba(191, 219, 254, 0.52);
  box-shadow:
    0 8px 22px rgba(2, 6, 23, 0.20),
    0 0 20px rgba(59, 130, 246, 0.12);
}

.chat-messages {
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.23), rgba(15, 23, 42, 0.05) 36%, rgba(2, 6, 23, 0.22)),
    radial-gradient(circle at 92% 18%, rgba(59, 130, 246, 0.09), transparent 34%);
  scrollbar-color: rgba(96, 165, 250, 0.52) rgba(15, 23, 42, 0.32);
}

.chat-messages::-webkit-scrollbar-track,
.chat-mention-popover::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.30);
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-mention-popover::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.68), rgba(37, 99, 235, 0.48));
  border-color: rgba(15, 23, 42, 0.48);
}

.chat-message {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(96, 165, 250, 0.035)),
    rgba(15, 23, 42, 0.24);
  border-color: rgba(147, 197, 253, 0.13);
  box-shadow:
    0 7px 18px rgba(2, 6, 23, 0.13),
    0 1px 0 rgba(255, 255, 255, 0.025) inset;
}

.chat-message.is-deleted {
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.055), rgba(59, 130, 246, 0.025)),
    rgba(15, 23, 42, 0.22);
}

.chat-meta {
  color: var(--chat-theme-text-soft);
  opacity: 1;
}

.chat-body {
  color: rgba(248, 250, 252, 0.96);
}

.chat-delete-btn {
  color: rgba(219, 234, 254, 0.68);
}

.chat-delete-btn:hover {
  color: #fff;
  background: rgba(59, 130, 246, 0.15);
}

.chat-delete-btn:focus-visible {
  outline-color: rgba(147, 197, 253, 0.60);
}

.chat-form {
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.58), rgba(8, 15, 26, 0.90)),
    rgba(15, 23, 42, 0.78);
  border-top-color: var(--chat-theme-line-soft);
  box-shadow:
    0 -14px 34px rgba(2, 6, 23, 0.20),
    0 1px 0 rgba(147, 197, 253, 0.08) inset;
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

.chat-input {
  color: var(--chat-theme-text);
  background:
    linear-gradient(145deg, rgba(15, 23, 42, 0.82), rgba(30, 41, 59, 0.66));
  border-color: rgba(125, 188, 255, 0.22);
  box-shadow:
    0 8px 22px rgba(2, 6, 23, 0.16) inset,
    0 1px 0 rgba(255, 255, 255, 0.035);
}

.chat-input::placeholder {
  color: rgba(191, 219, 254, 0.48);
}

.chat-input:focus {
  color: #fff;
  background:
    linear-gradient(145deg, rgba(15, 23, 42, 0.92), rgba(30, 58, 93, 0.72));
  border-color: rgba(96, 165, 250, 0.72);
  box-shadow:
    0 0 0 0.2rem rgba(59, 130, 246, 0.14),
    0 10px 24px rgba(2, 6, 23, 0.18) inset;
}

.chat-widget .chat-send-btn {
  color: #60a5fa !important;
  filter: drop-shadow(0 6px 14px rgba(37, 99, 235, 0.22));
}

.chat-widget .chat-send-btn:hover {
  color: #93c5fd !important;
  filter: drop-shadow(0 7px 18px rgba(59, 130, 246, 0.34));
}

.chat-status {
  color: rgba(191, 219, 254, 0.62) !important;
}

.chat-empty {
  color: rgba(191, 219, 254, 0.58) !important;
}

.chat-mention-popover {
  background:
    radial-gradient(circle at 90% 0%, rgba(59, 130, 246, 0.22), transparent 34%),
    linear-gradient(150deg, rgba(17, 27, 42, 0.98), rgba(8, 15, 26, 0.99));
  border-color: rgba(125, 188, 255, 0.24);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.46);
  scrollbar-color: rgba(96, 165, 250, 0.52) rgba(15, 23, 42, 0.32);
}

.chat-mention-option:hover,
.chat-mention-option.is-active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.30), rgba(14, 165, 233, 0.12));
}

.chat-mention-option-avatar {
  background:
    linear-gradient(145deg, rgba(59, 130, 246, 0.88), rgba(14, 165, 233, 0.64));
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.20);
}

.chat-mention {
  background: rgba(59, 130, 246, 0.20);
  color: #a7ccff;
  box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.07) inset;
}

/* Keep the compact mention notice text vertically centered even when actor aggregation changes. */
.chat-mention-notice-message {
  margin: 0 !important;
}
