/* The Ask Wavy trigger keeps its label on one line and its natural width; the topbar gives up
   space around it instead of folding "Ask Wavy" onto two lines. */
.btn-ask-wavy,
.btn-ask-elis {
  flex-shrink: 0;
  white-space: nowrap;
}

.activate_ai_button {
  min-width: 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;

  display: flex;
  justify-content: center;
  align-items: center;

  position: relative;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 2px 10px #00000033;
}

.crazy-orb {
  position: relative;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.orb-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation-fill-mode: forwards;
}

.orb-layer:nth-child(1) {
  background: conic-gradient(
    from 0deg,
    #2054cc,
    #ffffff,
    #1943a5,
    #84adff,
    #2054cc,
    #ffffff,
    #1943a5,
    #84adff
  );
  animation:
    spin-wild 3s ease-in-out infinite,
    morph-crazy 4s ease-in-out infinite,
    pulse-intense 2s ease-in-out infinite;
}

.orb-layer:nth-child(2) {
  background: radial-gradient(
    circle at 30% 70%,
    rgba(21, 94, 239, 0.8) 0%,
    rgba(255, 255, 255, 0.6) 25%,
    rgba(0, 64, 193, 0.7) 50%,
    rgba(132, 173, 255, 0.5) 75%,
    transparent 90%
  );
  animation:
    counter-spin 4s ease-in-out infinite,
    blob-dance 3.5s ease-in-out infinite,
    color-shift 5s ease-in-out infinite;
  transform-origin: center center;
}

.orb-layer:nth-child(3) {
  background: linear-gradient(
    45deg,
    rgba(21, 94, 239, 0.7) 0%,
    rgba(255, 255, 255, 0.5) 25%,
    rgba(0, 64, 193, 0.6) 50%,
    rgba(132, 173, 255, 0.8) 75%,
    rgba(21, 94, 239, 0.4) 100%
  );
  animation:
    wobble-extreme 2.8s ease-in-out infinite,
    scale-bounce 3.2s ease-in-out infinite,
    hue-rotate 6s linear infinite;
  filter: blur(0.5px);
}

.orb-layer:nth-child(4) {
  background: conic-gradient(
    from 180deg,
    rgba(21, 94, 239, 0.4),
    rgba(255, 255, 255, 0.3),
    rgba(0, 64, 193, 0.5),
    rgba(132, 173, 255, 0.4),
    rgba(21, 94, 239, 0.3),
    rgba(255, 255, 255, 0.4),
    rgba(0, 64, 193, 0.3),
    rgba(132, 173, 255, 0.5)
  );
  animation:
    spin-reverse 5s linear infinite,
    chaos-morph 4.2s ease-in-out infinite,
    opacity-wave 3s ease-in-out infinite;
  mix-blend-mode: overlay;
}

.button-text {
  font-size: var(--gf-text-section);
  font-weight: var(--gf-weight-bold);
  color: #2d3748;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
}

/* Crazy Animation Keyframes */
@keyframes spin-wild {
  0% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(90deg) scale(1.1) skew(5deg);
  }
  50% {
    transform: rotate(180deg) scale(0.9) skew(-5deg);
  }
  75% {
    transform: rotate(270deg) scale(1.05) skew(3deg);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes morph-crazy {
  0% {
    border-radius: 50%;
  }
  20% {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  }
  40% {
    border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%;
  }
  60% {
    border-radius: 40% 60% 80% 20% / 60% 40% 20% 80%;
  }
  80% {
    border-radius: 80% 20% 40% 60% / 20% 80% 60% 40%;
  }
  100% {
    border-radius: 50%;
  }
}

@keyframes pulse-intense {
  0%,
  100% {
    filter: brightness(1) saturate(1);
  }
  50% {
    filter: brightness(1.3) saturate(1.5);
  }
}

@keyframes counter-spin {
  0% {
    transform: rotate(0deg) translate(2px, 0) scale(1);
  }
  25% {
    transform: rotate(-90deg) translate(0, 2px) scale(1.2);
  }
  50% {
    transform: rotate(-180deg) translate(-2px, 0) scale(0.8);
  }
  75% {
    transform: rotate(-270deg) translate(0, -2px) scale(1.1);
  }
  100% {
    transform: rotate(-360deg) translate(2px, 0) scale(1);
  }
}

@keyframes blob-dance {
  0% {
    clip-path: ellipse(50% 50% at 50% 50%);
  }
  16% {
    clip-path: ellipse(45% 60% at 60% 40%);
  }
  32% {
    clip-path: ellipse(60% 45% at 40% 60%);
  }
  48% {
    clip-path: ellipse(40% 65% at 70% 30%);
  }
  64% {
    clip-path: ellipse(65% 40% at 30% 70%);
  }
  80% {
    clip-path: ellipse(55% 55% at 45% 55%);
  }
  100% {
    clip-path: ellipse(50% 50% at 50% 50%);
  }
}

@keyframes color-shift {
  0% {
    filter: hue-rotate(0deg) brightness(1);
  }
  33% {
    filter: hue-rotate(120deg) brightness(1.2);
  }
  66% {
    filter: hue-rotate(240deg) brightness(0.9);
  }
  100% {
    filter: hue-rotate(360deg) brightness(1);
  }
}

@keyframes wobble-extreme {
  0% {
    transform: rotate(0deg) skew(0deg) scale(1);
  }
  12% {
    transform: rotate(15deg) skew(5deg) scale(1.1);
  }
  24% {
    transform: rotate(-12deg) skew(-3deg) scale(0.95);
  }
  36% {
    transform: rotate(18deg) skew(7deg) scale(1.05);
  }
  48% {
    transform: rotate(-20deg) skew(-8deg) scale(0.9);
  }
  60% {
    transform: rotate(10deg) skew(4deg) scale(1.08);
  }
  72% {
    transform: rotate(-8deg) skew(-2deg) scale(0.98);
  }
  84% {
    transform: rotate(5deg) skew(1deg) scale(1.02);
  }
  100% {
    transform: rotate(0deg) skew(0deg) scale(1);
  }
}

@keyframes scale-bounce {
  0%,
  100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.15);
  }
  50% {
    transform: scale(0.85);
  }
  75% {
    transform: scale(1.05);
  }
}

@keyframes hue-rotate {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

@keyframes spin-reverse {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(-360deg);
  }
}

@keyframes chaos-morph {
  0% {
    border-radius: 50%;
    transform: scale(1) rotate(0deg);
  }
  14% {
    border-radius: 20% 80% 30% 70% / 50% 30% 70% 50%;
    transform: scale(1.3) rotate(45deg);
  }
  28% {
    border-radius: 80% 20% 70% 30% / 30% 70% 50% 50%;
    transform: scale(0.7) rotate(90deg);
  }
  42% {
    border-radius: 40% 60% 20% 80% / 70% 30% 80% 20%;
    transform: scale(1.1) rotate(135deg);
  }
  56% {
    border-radius: 70% 30% 80% 20% / 40% 60% 20% 80%;
    transform: scale(0.9) rotate(180deg);
  }
  70% {
    border-radius: 30% 70% 40% 60% / 80% 20% 70% 30%;
    transform: scale(1.2) rotate(225deg);
  }
  84% {
    border-radius: 60% 40% 70% 30% / 20% 80% 30% 70%;
    transform: scale(0.8) rotate(270deg);
  }
  100% {
    border-radius: 50%;
    transform: scale(1) rotate(360deg);
  }
}

@keyframes opacity-wave {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

/* Hover effects */
.btn-ask-wavy:hover .orb-layer:nth-child(1),
.btn-ask-elis:hover .orb-layer:nth-child(1) {
  animation-duration: 1.5s, 2s, 1s;
}

.btn-ask-wavy:hover .orb-layer:nth-child(2),
.btn-ask-elis:hover .orb-layer:nth-child(2) {
  animation-duration: 2s, 1.8s, 2.5s;
}

.btn-ask-wavy:hover .orb-layer:nth-child(3),
.btn-ask-elis:hover .orb-layer:nth-child(3) {
  animation-duration: 1.4s, 1.6s, 3s;
}

.btn-ask-wavy:hover .orb-layer:nth-child(4),
.btn-ask-elis:hover .orb-layer:nth-child(4) {
  animation-duration: 2.5s, 2.1s, 1.5s;
}

.sizemug_navbar_action:hover .orb-layer:nth-child(1) {
  animation-duration: 1.5s, 2s, 1s;
}

.sizemug_navbar_action:hover .orb-layer:nth-child(2) {
  animation-duration: 2s, 1.8s, 2.5s;
}

.sizemug_navbar_action:hover .orb-layer:nth-child(3) {
  animation-duration: 1.4s, 1.6s, 3s;
}

.sizemug_navbar_action:hover .orb-layer:nth-child(4) {
  animation-duration: 2.5s, 2.1s, 1.5s;
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.wavy_modal_wrapper {
  position: fixed;
  top: 4rem;
  left: 50%;
  z-index: 99999999999;

  display: none;
}

.wavy_modal {
  width: 30rem;
  background: white;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid var(--border-color);

  box-shadow: 0 8px 20px #00000033;
}

.orb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #84adff 0%, #2966f4 100%);
}

/* container inside overlay that Popper will position */
.ai_modal {
  position: absolute; /* IMPORTANT: Popper will set top/left on this element */
  left: 0;
  top: 0; /* initial fallback; popper will overwrite */
  transform-origin: top left; /* optional for animations */
  background: linear-gradient(to bottom, #e8f4f8 0%, #ffffff 100%) !important;
  border-radius: 22px;
  /* 540px = the old 450px default plus 20%: the initial state felt too narrow to read. */
  width: min(540px, calc(100vw - 16px));
  /* overflow: hidden; */
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 240ms cubic-bezier(0.2, 0, 0, 1),
    width 400ms cubic-bezier(0.2, 0, 0, 1),
    height 400ms cubic-bezier(0.2, 0, 0, 1),
    right 400ms cubic-bezier(0.2, 0, 0, 1),
    top 400ms cubic-bezier(0.2, 0, 0, 1),
    border-radius 400ms cubic-bezier(0.2, 0, 0, 1);
  z-index: 1000;
}

/* Sidebar mode */
.ai_modal.sidebar-mode {
  position: fixed !important;
  right: 10px !important;
  top: 8vh !important;
  left: auto !important;
  width: 540px !important;
  height: 90vh !important;
  border-radius: 20px;
  transform: none !important;
}

.ai_modal.sidebar-mode .sg-wavy-modal-container {
  height: calc(100dvh - 6rem);
  overflow-y: auto;
  scrollbar-width: none;

  padding-top: 6rem;
  padding-bottom: 1rem;
}

.ai_modal.sidebar-mode #sgWavyModalHistory {
  padding: 0 !important;
  max-height: none;
}

.ai_modal.sidebar-mode .modal-content {
  justify-content: flex-start;
  padding-top: 1rem;
}

/* show animation when overlay is active — still allowed when popper positions modal */
.ai_modal.active {
  opacity: 1;
  visibility: visible;
}

.ai_modal .sg-wavy-text-voice-options .switch {
  position: relative;
  display: inline-block;
  width: 42px;
  min-width: 42px;
  height: 24px;
  margin: 0;
}

.ai_modal .sg-wavy-text-voice-options .switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.ai_modal .sg-wavy-text-voice-options .switch .slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: 999px;
  background: #d0d5dd;
  transition:
    background 160ms cubic-bezier(0.2, 0, 0, 1),
    box-shadow 160ms cubic-bezier(0.2, 0, 0, 1);
}

.ai_modal .sg-wavy-text-voice-options .switch .slider::before {
  position: absolute;
  content: "";
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.22);
  transition: transform 160ms cubic-bezier(0.2, 0, 0, 1);
}

.ai_modal .sg-wavy-text-voice-options .switch input:checked + .slider {
  background: linear-gradient(90deg, #2966f4 0%, #2054cc 100%);
}

.ai_modal .sg-wavy-text-voice-options .switch input:checked + .slider::before {
  transform: translateX(18px);
}

.ai_modal .sg-wavy-text-voice-options .switch input:focus-visible + .slider {
  outline: 2px solid #84adff;
  outline-offset: 2px;
}

/* --- Mobile: center modal like before (fallback for small screens) --- */
@media (max-width: 640px) {
  .modal-overlay {
    display: flex; /* center on mobile */
    align-items: center;
    justify-content: center;
  }
  .modal {
    position: relative !important; /* disable absolute popper positioning */
    left: auto;
    top: auto;
    width: 92%;
    max-width: 680px;
    transform: scale(1);
  }
}

.ai_modal_wrapper {
  background: linear-gradient(
    to bottom right,
    #acd2e4 4%,
    #f2f4f7 30%,
    #f2f4f7 30%,
    #f2f4f7 40%,
    #b2ccff97
  );
  border: 1px solid #d0d5dd;

  height: 100%;

  display: flex;
  flex-direction: column;

  overflow: hidden;
  border-radius: 20px;
}

.ai_modal_wrapper .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-radius: 10px 10px 0 0;
  padding-bottom: 0;

  position: sticky;
  z-index: 100;

  backdrop-filter: blur(5px);
}

/* Header Search Bar */
.sg-wavy-header-search {
  display: none;
  position: relative;
  flex: 1;
  max-width: 400px;
}

.ai_modal.fullwidth-mode .sg-wavy-header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f2f4f7;
  border-radius: 30px;
  padding: 8px 12px;
  box-shadow: 2px 5px 10px #00000012;
}

.sg-wavy-header-search svg {
  flex-shrink: 0;
}

.sg-wavy-header-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: var(--gf-text-body);
  color: #98a2b3;
  caret-color: #667085;
  font-size: var(--gf-text-body);
}

.sg-wavy-header-search input::placeholder {
  color: #98a2b3;
}

/* Header Action Buttons */
.sg-wavy-header-actions {
  display: none;
  align-items: center;
  gap: 10px;
}

.ai_modal.fullwidth-mode .sg-wavy-header-actions {
  display: flex;
}

.sg-wavy-header-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #d0d5dd;
  background: white;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  color: #344054;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-header-btn:hover {
  background: #f9fafb;
  border-color: #98a2b3;
}

.sg-wavy-header-btn svg {
  flex-shrink: 0;
}

button.sg-wavy-new-chat-btn,
button.sg-wavy-share-btn {
  width: initial !important;
  height: initial !important;
  border-radius: 30px !important;
  padding: 8px 16px;
}

.sg-wavy-new-chat-btn {
  background: var(--gf-blue) !important;
  border-color: transparent;
  color: white;
}

/* Mobile menu button */
.sg-wavy-mobile-menu {
  display: flex;
}

.ai_modal.fullwidth-mode .sg-wavy-mobile-menu {
  display: none;
}

.sg-wavy-initial-content {
  height: 140px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ai_modal.sidebar-mode .sg-wavy-initial-content {
  height: 100%;
}

#sgWavyModalInitial .sg-wavy-text-voice .input-container {
  margin-top: auto;
}

.sg-wavy-text-voice {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.sg-wavy-modal-container {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ai_modal_wrapper .modal-header button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #d0d5dd;
  background: #ffffff;

  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;

  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0 1rem;
}

.tone-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  color: #101828;
  font-size: var(--gf-text-caption);

  padding: 6px 10px;
  border-radius: 20px;
}

.ai_modal.fullwidth-mode .tone-selector {
  display: none;
}

.ai_modal.fullwidth-mode .sg-wavy-external-btn {
  display: none;
}

.tone-selector[data-title="colloquial"] {
  background: #d1fadf;
  color: #027a48;
}

.tone-selector[data-title="colloquial"] svg path {
  fill: #12b76a;
}

.tone-selector[data-title="formal"] {
  background: #d1e0ff;
  color: #2054cc;
}

.tone-selector[data-title="formal"] svg path {
  fill: #528bff;
}

.tone-selector[data-title="history"] svg {
  display: none;
}

.sg-wavy-text-voice-options-btn {
  position: relative;
}

.sg-wavy-text-voice-options-btn[aria-expanded="true"]
  ul.sg-wavy-text-voice-options {
  display: block;
  animation: Dropdown 0.3 ease;
}

.sg-wavy-text-voice-options-btn svg {
  display: none;
}

.sg-wavy-text-voice-options-btn[data-current="initial"] svg.ellipsis {
  display: block;
}

.sg-wavy-text-voice-options-btn[data-current="initial"] svg.ellipsis,
.sg-wavy-text-voice-options-btn[data-current="history"] svg.back,
.sg-wavy-text-voice-options-btn[data-current="chat"] svg.back,
.sg-wavy-text-voice-options-btn[data-current="speak"] svg.back {
  display: block;
}

.sg-wavy-external-btn svg {
  display: none;
}

.sg-wavy-external-btn[data-current="initial"] svg.history,
.sg-wavy-external-btn[data-current="chat"] svg.external,
.sg-wavy-external-btn[data-current="speak"] svg.external,
.sg-wavy-external-btn[data-current="history"] svg.trash {
  display: block;
}

.sg-wavy-text-voice-options {
  position: absolute;
  top: 2px;
  left: 2.5rem;
  border: 1px solid #d0d5dd;
  background: #ffffff;
  padding: 7px;
  border-radius: 20px;

  width: 15rem;
  display: none;
}

.sg-wavy-text-voice-options li {
  position: relative !important;
  width: 100%;
  min-width: 0;
  border-radius: 20px;
  transition: background-color 240ms cubic-bezier(0.2, 0, 0, 1);

  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 10px;

  padding: 6px 15px;
  font-size: var(--gf-text-body);

  /* The dashboard shell's generic `.sidebar` rule (dashboard-revamp.css) also
     matches the "Fix as sidebar" item, giving it a permanent background, a
     min-width and a mobile off-screen transform. Reset those shell properties
     so every item behaves like the others (hover-only highlight). */
  background: transparent;
  overflow: visible;
  transform: none;
  z-index: auto;
}

.sg-wavy-text-voice-options li:not(:last-child) {
  margin-bottom: 5px;
}

.sg-wavy-text-voice-options li:hover {
  background: #f2f4f7;
}

.sg-wavy-text-voice-options li.active {
  background: #f2f4f7;
}

.sg-wavy-text-voice-options li:hover svg.gr-none,
.sg-wavy-text-voice-options li.active svg.gr-none,
.sg-wavy-text-voice-options li svg.gr {
  display: none;
}

.sg-wavy-text-voice-options li:hover svg.gr,
.sg-wavy-text-voice-options li svg.gr-none,
.sg-wavy-text-voice-options li.active svg.gr {
  display: block;
}

.sg-wavy-text-voice-options li:hover > span,
.sg-wavy-text-voice-options li.activ > span {
  background: linear-gradient(90deg, #2966f4 0%, #2054cc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.sg-wavy-text-voice-options li .switch {
  flex: 0 0 42px;
  margin-left: auto;
  margin-bottom: 0 !important;
}

.sg-wavy-text-voice-options li:last-child {
  justify-content: space-between;
  gap: 16px;
}

.sg-wavy-text-voice-options li:last-child > span:first-child {
  min-width: 0;
  white-space: nowrap;
}

.gradient-orb {
  flex: 0 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: linear-gradient(135deg, #84adff 0%, #2966f4 50%, #2054cc 100%);
  animation: pulse 3s ease-in-out infinite;
}

.gradient-orb.sm {
  width: 40px;
  height: 40px;
  min-height: 40px;
}

.gradient-orb.md {
  width: 90px;
  height: 90px;
}

.gradient-orb.lg {
  width: 120px;
  height: 120px;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.sg-wavy-text-voice {
  width: 100%;
  display: flex;
  flex-direction: column;
  height: 100%;
}

#sgWavyModalChat {
  display: flex;
  flex-direction: column;
}

.sg-wavy-text-voice .greeting {
  font-size: var(--gf-text-card);
  font-weight: var(--gf-weight-semibold);
  color: #101828;
  margin: 8px 0;
}

.sg-wavy-text-voice .question {
  font-size: var(--gf-text-card);
  font-weight: var(--gf-weight-semibold);
  color: #101828;
}

.sg-wavy-text-voice .question .highlight {
  color: #2054cc;
}

.sg-wavy-text-voice .input-container {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: auto;
  border: none;
}

.ai_modal.sidebar-mode .sg-wavy-text-voice .input-container {
  flex-direction: column;
}

.sg-wavy-text-voice .input-container button {
  flex: 1;
  padding: 13px 10px;
  border: none;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  border-radius: 50px;

  box-shadow: 2px 5px 10px #00000012;
}

.sg-wavy-text-voice .type-btn {
  background: #f2f4f7;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
  color: #4e5561;
}

.sg-wavy-text-voice .type-btn:hover {
  background: #f5f5f5;
}

.sg-wavy-text-voice .speak-btn {
  background: linear-gradient(to right, #2966f4, #2966f4);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-textarea-container {
  background: #f2f4f7;
  border-radius: 70px;
  padding: 8px 10px;
  width: 100%;

  display: flex;
  flex-direction: column;
  gap: 8px;

  margin-top: 0.5rem;
  transition:
    border-radius 240ms cubic-bezier(0.2, 0, 0, 1),
    padding 240ms cubic-bezier(0.2, 0, 0, 1);

  position: relative;
}

.sg-wavy-textarea-container.expanded {
  border-radius: 24px;
  padding: 16px 16px;
  padding-bottom: 10px !important ;
}

.sg-wavy-textarea-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.sg-wavy-textarea-container.expanded .sg-wavy-textarea-input-row {
  align-items: flex-start;
}

.sg-wavy-textarea-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  border-radius: 50%;
  color: #101828;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-textarea-icon:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Cross-line (hidden by default) */
.sg-wavy-textarea-icon .inline-mic-cross {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms cubic-bezier(0.2, 0, 0, 1);
}

/* Timer (hidden by default) */
.sg-wavy-textarea-icon .inline-mic-timer {
  display: none;
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: var(--gf-weight-semibold);
  color: #ef4444;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* ── Recording state ── */
.sg-wavy-textarea-icon.inline-recording {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  animation: inlineMicPulse 1.4s ease-in-out infinite;
}

.sg-wavy-textarea-icon.inline-recording .inline-mic-cross {
  opacity: 1;
}

.sg-wavy-textarea-icon.inline-recording .inline-mic-timer {
  display: block;
}

@keyframes inlineMicPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
}

.sg-wavy-textarea-container.expanded .sg-wavy-textarea-icon {
  margin-top: 0;
}

.wavy_text_send_btn {
  min-width: 30px;
  width: 30px;
  height: 30px;

  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px;
  flex-shrink: 0;

  border-radius: 50%;
  background: linear-gradient(to top right, #2966f4, #2054cc);
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}

.wavy_text_send_btn:hover {
  transform: scale(1.05);
}

.sg-wavy-textarea-container.expanded .wavy_text_send_btn {
  width: 48px;
  height: 48px;
  align-self: flex-end;
}

.wavy_text_send_btn[data-wavy-stop="true"] svg,
.wavy_text_send_btn svg.wavy_text_stop_icon {
  display: none;
}

.wavy_text_send_btn[data-wavy-stop="true"] svg.wavy_text_stop_icon {
  display: block;
}

.sg-wavy-textarea-container textarea {
  background: none;
  font-size: var(--gf-text-body);
  width: 100%;
  color: #667085;
  caret-color: #2966f4;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  line-height: var(--gf-leading-body);
  min-height: 20px;
  max-height: 200px;
  overflow-y: auto;
}

.sg-wavy-textarea-container.expanded textarea {
  font-size: var(--gf-text-body);
  min-height: 80px;
}

.sg-wavy-textarea-container textarea::placeholder {
  color: #98a2b3;
}

/* Scrollbar for textarea */
.sg-wavy-textarea-container textarea::-webkit-scrollbar {
  width: 4px;
}

.sg-wavy-textarea-container textarea::-webkit-scrollbar-track {
  background: transparent;
}

.sg-wavy-textarea-container textarea::-webkit-scrollbar-thumb {
  background: #d0d5dd;
  border-radius: 2px;
}

.sg-wavy-textarea-container textarea::-webkit-scrollbar-thumb:hover {
  background: #98a2b3;
}

/* Tone Badge */
.sg-wavy-textarea-tone-badge {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: #d1fadf;
  color: #027a48;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
  white-space: nowrap;
  align-self: flex-start;
  margin-left: 4px;
}

.sg-wavy-textarea-tone-badge svg {
  width: 14px;
  height: 14px;
  color: #12b76a;
}

/* Show only on desktop when NOT typing */
@media (min-width: 769px) {
  .sg-wavy-textarea-tone-badge {
    display: flex;
  }
}

/* Hide when expanded (typing) in normal mode */
.sg-wavy-textarea-container.expanded .sg-wavy-textarea-tone-badge {
  display: none !important;
}

/* Full width mode: ALWAYS show badge while typing, hide when not typing */
.ai_modal.fullwidth-mode .sg-wavy-textarea-tone-badge {
  display: none !important;
}

.ai_modal.fullwidth-mode
  .sg-wavy-textarea-container.expanded
  .sg-wavy-textarea-tone-badge {
  display: flex !important;
}

/* Chat Messages */
.sg-wavy-chat-header {
  text-align: center;
  margin-bottom: 20px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.sg-wavy-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;

  width: 100%;
  max-height: 65vh;
  scrollbar-width: none;
}

.sg-wavy-chat-message {
  display: flex;
  gap: 12px;
  animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sg-wavy-chat-message.user {
  flex-direction: row-reverse;
  align-self: flex-end;
  width: 100%;
}

.sg-wavy-chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;

  box-shadow: 0px 3px 6px #0000001f;
}

.sg-wavy-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sg-wavy-chat-avatar.user {
  position: relative;
  overflow: visible;
  box-shadow: none;
}

.sg-wavy-chat-user-avatar-inner {
  position: relative;
  z-index: 2;
  width: 75%;
  height: 75%;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
}

.sg-wavy-chat-user-avatar-inner img {
  display: block;
}

.sg-wavy-chat-avatar-badge {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 135%;
  height: 135%;
  transform: translate(-50%, calc(-50% + 7%));
  pointer-events: none;
}

.sg-wavy-chat-avatar.ai {
  background: linear-gradient(135deg, #84adff 0%, #2966f4 50%, #2054cc 100%);
}

.sg-wavy-chat-message-content {
  max-width: 70%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sg-wavy-chat-message.user .sg-wavy-chat-message-content {
  align-items: flex-end;
  max-width: 100%;
  width: 100%;
}

.sg-wavy-chat-bubble {
  padding: 6px 15px;
  border-radius: 18px;
  font-size: var(--gf-text-body);
  line-height: var(--gf-leading-body);
  box-shadow:
    0 10px 15px -3px #0000001a,
    0 4px 6px -4px #0000001a;
}

.sg-wavy-chat-message.user .sg-wavy-chat-bubble {
  background: #344054;
  color: white;
  border-bottom-right-radius: 4px;
}

.sg-wavy-chat-message.ai .sg-wavy-chat-bubble {
  background: #f2f4f7;
  color: #344054;
  border-bottom-left-radius: 4px;
  /* Model answers read as prose: left aligned, never centred. */
  text-align: left;
}

/* ==========================================
   AI Markdown Typography
   ========================================== */
/* ---------------------------------------------------------------------------
   Rendered answers.

   The assistant writes in markdown, so the answer pane has to behave like a
   document: a real type scale, rhythm between blocks, and a distinct look for
   each content type (list, quote, table, code, task list). Everything is scoped
   to .sg-wavy-markdown so the chat UI around it is untouched.
   --------------------------------------------------------------------------- */

.sg-wavy-markdown {
  font-family: var(--gf-font);
  color: #1f2937;
  font-size: var(--gf-text-body);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.sg-wavy-markdown > :first-child {
  margin-top: 0;
}

.sg-wavy-markdown > :last-child {
  margin-bottom: 0;
}

/* Type scale: h1 and h2 lead a section, h3/h4 label one, h5/h6 are labels. */
.sg-wavy-markdown h1,
.sg-wavy-markdown h2,
.sg-wavy-markdown h3,
.sg-wavy-markdown h4,
.sg-wavy-markdown h5,
.sg-wavy-markdown h6 {
  margin: 1.15em 0 0.45em;
  color: #0f172a;
  font-weight: var(--gf-weight-bold);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.sg-wavy-markdown h1 {
  font-size: 1.32em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid #edf0f5;
}

.sg-wavy-markdown h2 {
  font-size: 1.18em;
}

.sg-wavy-markdown h3 {
  font-size: 1.06em;
}

.sg-wavy-markdown h4,
.sg-wavy-markdown h5,
.sg-wavy-markdown h6 {
  font-size: 1em;
  color: #344054;
}

.sg-wavy-markdown p {
  margin: 0.65em 0;
  color: #344054;
}

.sg-wavy-markdown ul,
.sg-wavy-markdown ol {
  margin: 0.6em 0 0.75em;
  padding-left: 1.35em;
}

.sg-wavy-markdown ul {
  list-style: disc;
}

.sg-wavy-markdown ol {
  list-style: decimal;
}

.sg-wavy-markdown li {
  margin: 0.32em 0;
  padding-left: 0.15em;
  color: #344054;
}

.sg-wavy-markdown li::marker {
  color: #98a2b3;
}

/* Indented items read as a sub-list without nesting invalid markup. */
.sg-wavy-markdown li[data-depth="1"] {
  margin-left: 1.1em;
  list-style-type: circle;
}

.sg-wavy-markdown li[data-depth="2"],
.sg-wavy-markdown li[data-depth="3"] {
  margin-left: 2.2em;
  list-style-type: square;
}

.sg-wavy-markdown li > ul,
.sg-wavy-markdown li > ol {
  margin: 0.3em 0 0.3em;
}

.sg-wavy-markdown strong {
  font-weight: var(--gf-weight-bold);
  color: #101828;
}

.sg-wavy-markdown em {
  font-style: italic;
}

.sg-wavy-markdown del {
  color: #98a2b3;
}

.sg-wavy-markdown a {
  color: #2054cc;
  text-decoration: underline;
  text-decoration-color: rgba(32, 84, 204, 0.35);
  text-underline-offset: 2px;
  transition: text-decoration-color 120ms ease;
}

.sg-wavy-markdown a:hover {
  text-decoration-color: currentColor;
}

.sg-wavy-markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  background: #eef1f6;
  border: 1px solid #e4e8ef;
  border-radius: 6px;
  padding: 0.08em 0.36em;
  color: #0f172a;
}

.sg-wavy-markdown blockquote {
  margin: 0.8em 0;
  padding: 0.55em 0.95em;
  border-left: 3px solid #c7d2fe;
  border-radius: 0 8px 8px 0;
  background: #f7f9ff;
  color: #475467;
  font-style: italic;
}

.sg-wavy-markdown hr {
  margin: 1.15em 0;
  border: 0;
  border-top: 1px solid #eaecf0;
}

.sg-wavy-markdown .sg-wavy-md-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0.85em 0;
  border: 1px solid #eaecf0;
  border-radius: 12px;
}

/* Code block: dark surface, language chip on the left, copy on the right. */
.sg-wavy-markdown .sg-wavy-md-code {
  margin: 0.9em 0;
  border-radius: 12px;
  overflow: hidden;
  background: #0f1729;
  box-shadow: 0 1px 2px rgba(15, 23, 41, 0.16);
}

.sg-wavy-markdown .sg-wavy-md-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sg-wavy-markdown .sg-wavy-md-code-lang {
  font-size: 0.78em;
  font-weight: var(--gf-weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9fb0cc;
}

.sg-wavy-markdown .sg-wavy-md-code-copy {
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: transparent;
  color: #cbd5e1;
  font-size: 0.78em;
  font-weight: var(--gf-weight-semibold);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.sg-wavy-markdown .sg-wavy-md-code-copy:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sg-wavy-markdown .sg-wavy-md-code-copy.is-copied {
  border-color: rgba(134, 239, 172, 0.5);
  color: #86efac;
}

.sg-wavy-markdown .sg-wavy-md-code pre {
  margin: 0;
  padding: 0.85rem 1rem;
  overflow-x: auto;
}

.sg-wavy-markdown .sg-wavy-md-code code,
.sg-wavy-markdown .sg-wavy-md-code code[class*="language-"] {
  display: block;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: #e6edf7;
  font-size: 0.86em;
  line-height: 1.6;
  white-space: pre;
  tab-size: 2;
}

/* Tables scroll instead of squashing the bubble. */
.sg-wavy-markdown .sg-wavy-md-table-wrap {
  margin: 0.9em 0;
  overflow-x: auto;
  border: 1px solid #e6eaf1;
  border-radius: 12px;
}

.sg-wavy-markdown .sg-wavy-md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
  background: #ffffff;
}

.sg-wavy-markdown .sg-wavy-md-table th,
.sg-wavy-markdown .sg-wavy-md-table td {
  padding: 9px 13px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #eef1f6;
}

.sg-wavy-markdown .sg-wavy-md-table th {
  background: #f8fafc;
  color: #101828;
  font-weight: var(--gf-weight-bold);
  white-space: nowrap;
}

.sg-wavy-markdown .sg-wavy-md-table tbody tr:last-child td {
  border-bottom: 0;
}

.sg-wavy-markdown .sg-wavy-md-table tbody tr:nth-child(even) {
  background: #fcfdff;
}

/* Task lists read as a checklist, not as bullets with brackets. */
.sg-wavy-markdown .sg-wavy-md-tasks {
  list-style: none;
  padding-left: 0.2em;
}

.sg-wavy-markdown .sg-wavy-md-task {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.sg-wavy-markdown .sg-wavy-md-task input {
  margin: 0.35em 0 0;
  width: 15px;
  height: 15px;
  accent-color: #2054cc;
  flex: 0 0 auto;
}

.sg-wavy-markdown .sg-wavy-md-task input:checked + span {
  color: #98a2b3;
  text-decoration: line-through;
}

/* Legacy class kept so cached answers rendered by the old path still look right. */
.sg-wavy-markdown .sg-wavy-code-block {
  margin: 0.6rem 0;
  background: #0f1729;
  color: #e6edf7;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  overflow-x: auto;
}

.sg-wavy-markdown .sg-wavy-code-block code {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
  font-size: var(--gf-text-caption);
}

.sg-wavy-chat-bubble.thinking {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
}

.sg-wavy-chat-actions {
  display: flex;
  gap: 8px;
  padding: 0 4px;
}

/* Message meta — send time plus model/token usage (sizemug parity) */
.sg-wavy-chat-meta {
  padding: 0 4px;
  margin-top: 4px;
  font-size: var(--gf-text-caption);
  line-height: var(--gf-leading-caption);
  color: #667085;
}

.sg-wavy-chat-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #667085;
  transition: color 160ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-chat-action-btn:hover {
  color: #344054;
}

.sg-wavy-chat-action-btn.liked {
  color: #10b981;
}

.sg-wavy-chat-action-btn.disliked {
  color: #ef4444;
}

/* Thinking animation */
.sg-wavy-thinking-dots {
  display: flex;
  gap: 4px;
}

.sg-wavy-thinking-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #667085;
  animation: thinkingBounce 1.4s infinite ease-in-out both;
}

.sg-wavy-thinking-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.sg-wavy-thinking-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes thinkingBounce {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Share Modal */
.sg-wavy-share-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10001;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 240ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-share-modal-overlay.active {
  display: flex;
  opacity: 1;
}

.sg-wavy-share-modal {
  background: white;
  border-radius: 20px;
  width: 90%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px 15px;
  animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sg-wavy-share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sg-wavy-share-modal-header h2 {
  font-size: var(--gf-text-card);
  font-weight: var(--gf-weight-semibold);
  color: #101828;
}

.sg-wavy-share-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 160ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-share-close:hover {
  background: #e5e7eb;
}

.sg-wavy-share-description {
  font-size: var(--gf-text-body);
  color: #475467;
  line-height: var(--gf-leading-body);
  margin-bottom: 24px;
}

.sg-wavy-share-section {
  margin-bottom: 14px;
}

.sg-wavy-share-section h3 {
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-medium);
  color: #101828;
  margin-bottom: 12px;
}

.sg-wavy-share-recents {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.sg-wavy-share-recent-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 70px;
}

.sg-wavy-share-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  box-shadow: 0px 8px 10px #00000018;
}

.sg-wavy-share-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sg-wavy-share-recent-item span {
  font-size: var(--gf-text-caption);
  color: #344054;
  text-align: center;
}

.sg-wavy-share-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #2966f4;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-share-send-btn:hover {
  background: #2054cc;
  transform: scale(1.05);
}

.sg-wavy-share-send-btn.sent {
  background: #10b981;
}

.sg-wavy-share-platforms {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.sg-wavy-share-platform {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-share-platform:hover {
  transform: translateY(-2px);
}

.sg-wavy-share-platform-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sg-wavy-share-platform span {
  font-size: var(--gf-text-caption);
  color: #344054;
  text-align: center;
}

.sg-wavy-share-copy {
  display: flex;
  gap: 12px;
  align-items: center;

  background: #f2f4f7;
  border-radius: 40px;
  padding: 8px 16px;
  padding-right: 5px;
}

.sg-wavy-share-copy input {
  flex: 1;
  font-size: var(--gf-text-body);
  color: #667085;
  background: none;
}

.sg-wavy-copy-btn {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 10px 20px;
  border-radius: 30px;
  border: none;
  background: var(--gf-blue);
  color: white;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .sg-wavy-share-platforms {
    grid-template-columns: repeat(auto, minmax(150px, 1fr));
  }

  .sg-wavy-share-copy {
    flex-direction: column;
  }

  .sg-wavy-copy-btn {
    width: 100%;
    justify-content: center;
  }
}

.sg-wavy-textarea-suggestions {
  position: absolute;
  top: -3.05rem;

  overflow-x: auto;
  scrollbar-width: none;

  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sg-wavy-textarea-suggestion-item {
  background: #344054;
  color: #ffffff;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);

  white-space: nowrap;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
}

.sg-wavy-textarea-suggestion-item:hover {
  background: #4a5a73;
  transform: translateY(-1px);
}

/* ==========================================
   Tool Selection Chips
   ========================================== */
.sg-wavy-tool-bar {
  display: none !important;
}
.sg-wavy-tool-bar::-webkit-scrollbar {
  display: none;
}
.sg-wavy-tool-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid #d0d5dd;
  background: transparent;
  color: #667085;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
  white-space: nowrap;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}
.sg-wavy-tool-chip i {
  font-size: var(--gf-text-micro);
}
.sg-wavy-tool-chip:hover {
  border-color: #2054cc;
  color: #2054cc;
  background: rgba(21, 94, 239, 0.05);
}
.sg-wavy-tool-chip.active {
  border-color: #2054cc;
  background: rgba(21, 94, 239, 0.12);
  color: #2054cc;
}

/* ==========================================
   Sources Card
   ========================================== */
.sg-wavy-sources {
  margin-top: 8px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  overflow: hidden;
}
.sg-wavy-sources-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #f9fafb;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-semibold);
  color: #344054;
  border-bottom: 1px solid #e4e7ec;
}
.sg-wavy-sources-header i {
  font-size: var(--gf-text-micro);
  color: #2054cc;
}
.sg-wavy-sources-list {
  display: flex;
  flex-direction: column;
}
.sg-wavy-source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  text-decoration: none;
  color: #344054;
  font-size: var(--gf-text-caption);
  transition: background 160ms cubic-bezier(0.2, 0, 0, 1);
  border-bottom: 1px solid #f2f4f7;
}
.sg-wavy-source-item:last-child {
  border-bottom: none;
}
.sg-wavy-source-item:hover {
  background: #f9fafb;
}
.sg-wavy-source-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2054cc;
  color: #fff;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-semibold);
  flex-shrink: 0;
}
.sg-wavy-source-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================
   Deep Thinking Panel
   The reasoning view from the design reference: a white card whose header carries the
   orb, the label and — while the thought is still streaming — the pulsing ring, the
   typing dots and a sliding progress line. Steps lay out as numbered cards joined by a
   connector once the thought settles.
   ========================================== */
@keyframes sg-wavy-dc-dot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}
@keyframes sg-wavy-dc-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(400%);
  }
}
@keyframes sg-wavy-dc-caret {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}
@keyframes sg-wavy-dc-ring {
  0% {
    transform: scale(0.85);
    opacity: 0.55;
  }
  100% {
    transform: scale(1.7);
    opacity: 0;
  }
}

.sg-wavy-deep-thinking {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.sg-wavy-thinking-panel {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 30px rgba(40, 60, 120, 0.12);
}

/* header ------------------------------------------------------------- */

.sg-wavy-thinking-panel > summary {
  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: linear-gradient(90deg, #e9f0ff 0%, #f6f9ff 60%, #ffffff 100%);
  cursor: pointer;
  text-align: left;
  list-style: none;
  user-select: none;
}

.sg-wavy-thinking-panel > summary::-webkit-details-marker {
  display: none;
}

.sg-wavy-thinking-panel[data-state="streaming"] > summary {
  min-height: 56px;
  padding: 0 18px 0 14px;
}

.sg-wavy-thinking-panel[data-state="done"] > summary {
  min-height: 60px;
  padding: 10px 18px 10px 14px;
}

/* the orb: sparkle while thinking, a tick once the thought settles */
.sg-wavy-thinking-orb {
  position: relative;
  flex: none;
  width: 28px;
  height: 28px;
}

.sg-wavy-thinking-orb-core {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: radial-gradient(circle at 30% 26%, #a4beff 0%, #3366e8 55%, #2447b8 100%);
  box-shadow: 0 5px 14px rgba(51, 102, 232, 0.35);
}

.sg-wavy-thinking-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: #3366e8;
  opacity: 0.3;
  animation: sg-wavy-dc-ring 1.8s ease-out infinite;
}

.sg-wavy-thinking-panel[data-state="done"] .sg-wavy-thinking-orb-ring {
  display: none;
}

.sg-wavy-thinking-headings {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sg-wavy-thinking-label {
  font-size: var(--gf-text-note);
  font-weight: var(--gf-weight-semibold);
  line-height: 22px;
  color: #2447b8;
  white-space: nowrap;
}

.sg-wavy-thinking-summary,
.sg-wavy-thinking-summary-open {
  display: none;
  font-size: var(--gf-text-label);
  line-height: 18px;
  color: #5b6577;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sg-wavy-thinking-panel[data-state="done"]:not([open]) .sg-wavy-thinking-summary,
.sg-wavy-thinking-panel[data-state="done"][open] .sg-wavy-thinking-summary-open {
  display: block;
}

/* typing dots — the card's own, lighter and smaller than the chat bubble's */
.sg-wavy-thinking-panel .sg-wavy-thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sg-wavy-thinking-panel .sg-wavy-thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: #3366e8;
  animation: sg-wavy-dc-dot 1.2s ease-in-out infinite;
}

.sg-wavy-thinking-panel .sg-wavy-thinking-dot:nth-child(1) {
  animation-delay: 0s;
}

.sg-wavy-thinking-panel .sg-wavy-thinking-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.sg-wavy-thinking-panel .sg-wavy-thinking-dot:nth-child(3) {
  animation-delay: 0.3s;
}

.sg-wavy-thinking-status {
  flex: none;
  font-size: var(--gf-text-label);
  color: #5b6577;
  font-variant-numeric: tabular-nums;
}

.sg-wavy-thinking-spacer {
  flex: 1;
  min-width: 0;
}

.sg-wavy-thinking-count {
  display: none;
  flex: none;
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  background: #e8eeff;
  color: #2f4fb8;
  font-size: var(--gf-text-chip);
  font-weight: var(--gf-weight-semibold);
  align-items: center;
}

.sg-wavy-thinking-toggle-text {
  display: none;
  flex: none;
  font-size: var(--gf-text-label);
  font-weight: var(--gf-weight-semibold);
  color: #2447b8;
}

.sg-wavy-thinking-panel[data-state="done"] .sg-wavy-thinking-count {
  display: inline-flex;
}

.sg-wavy-thinking-panel[data-state="done"]:not([open]) .sg-wavy-thinking-toggle-closed {
  display: inline-flex;
}

.sg-wavy-thinking-panel[data-state="done"][open] .sg-wavy-thinking-toggle-open {
  display: inline-flex;
}

.sg-wavy-thinking-panel[data-state="done"] .sg-wavy-thinking-dots,
.sg-wavy-thinking-panel[data-state="done"] .sg-wavy-thinking-status {
  display: none;
}

.sg-wavy-thinking-chevron {
  flex: none;
  width: 16px;
  height: 16px;
  border-right: 1.9px solid #4b5563;
  border-bottom: 1.9px solid #4b5563;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  margin-top: -4px;
}

.sg-wavy-thinking-panel[open] .sg-wavy-thinking-chevron {
  transform: rotate(-135deg);
  margin-top: 2px;
}

/* progress line: a sliding sheen while thinking, a full bar once settled */
.sg-wavy-thinking-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: #e3eafb;
  overflow: hidden;
}

.sg-wavy-thinking-progress-bar {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(135deg, #7497ef 0%, #3366e8 100%);
}

.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-progress-bar {
  width: 25%;
  background: linear-gradient(90deg, transparent 0%, #3366e8 50%, transparent 100%);
  animation: sg-wavy-dc-slide 1.6s ease-in-out infinite;
}

/* content ------------------------------------------------------------ */

.sg-wavy-thinking-content {
  display: flex;
  flex-direction: column;
}

.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-content {
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding: 14px 14px 16px;
}

.sg-wavy-thinking-panel[data-state="done"] .sg-wavy-thinking-content {
  gap: 0;
  padding: 18px 18px 6px;
  border-top: 1px solid #e3eafb;
}

/* "Show earlier steps (N)" while the thought streams */
.sg-wavy-thinking-earlier > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  height: 28px;
  padding: 0 12px;
  border-radius: 14px;
  background: #eef2ff;
  color: #2f4fb8;
  font-size: var(--gf-text-chip);
  font-weight: var(--gf-weight-semibold);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.sg-wavy-thinking-earlier > summary::-webkit-details-marker {
  display: none;
}

.sg-wavy-thinking-earlier > summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid #2f4fb8;
  border-bottom: 2px solid #2f4fb8;
  transform: rotate(-135deg);
  margin-top: 2px;
}

.sg-wavy-thinking-earlier[open] > summary::before {
  transform: rotate(45deg);
  margin-top: -2px;
}

.sg-wavy-thinking-earlier-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

/* the disclosure renames itself once the earlier steps are open */
.sg-wavy-thinking-earlier .sg-wavy-thinking-earlier-hide {
  display: none;
}

.sg-wavy-thinking-earlier[open] .sg-wavy-thinking-earlier-show {
  display: none;
}

.sg-wavy-thinking-earlier[open] .sg-wavy-thinking-earlier-hide {
  display: inline;
}

/* steps -------------------------------------------------------------- */

.sg-wavy-thinking-step {
  display: flex;
  gap: 14px;
}

.sg-wavy-thinking-step-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 28px;
  flex: none;
}

.sg-wavy-thinking-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 14px;
  background: #e8eeff;
  color: #2f4fb8;
  font-size: var(--gf-text-label);
  font-weight: var(--gf-weight-bold);
  font-variant-numeric: tabular-nums;
}

.sg-wavy-thinking-step-line {
  flex: 1;
  width: 2px;
  min-height: 12px;
  margin: 4px 0;
  border-radius: 1px;
  background: linear-gradient(180deg, #c9d8fb 0%, #e3eafb 100%);
}

.sg-wavy-thinking-step:last-child .sg-wavy-thinking-step-line {
  display: none;
}

.sg-wavy-thinking-step:last-child .sg-wavy-thinking-step-num {
  background: linear-gradient(135deg, #7497ef 0%, #3366e8 100%);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(51, 102, 232, 0.35);
}

.sg-wavy-thinking-step-card {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid #e6ebf5;
  border-radius: 14px;
  background: #ffffff;
  margin-bottom: 10px;
}

.sg-wavy-thinking-step:last-child .sg-wavy-thinking-step-card {
  margin-bottom: 12px;
  border-color: #c9d8fb;
  background: linear-gradient(135deg, #f1f5ff 0%, #e6eeff 100%);
}

.sg-wavy-thinking-step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sg-wavy-thinking-step-title {
  font-size: var(--gf-text-label);
  font-weight: var(--gf-weight-bold);
  color: #1f2a5c;
}

.sg-wavy-thinking-step-hint {
  font-size: var(--gf-text-chip);
  color: #6b7280;
  min-width: 0;
}

.sg-wavy-thinking-step-state {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  flex: none;
}

.sg-wavy-thinking-step-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  background: #e8eeff;
  color: #2f4fb8;
  font-size: var(--gf-text-micro);
  font-weight: var(--gf-weight-semibold);
  white-space: nowrap;
}

.sg-wavy-thinking-step-text {
  margin-top: 6px;
  font-size: var(--gf-text-small);
  line-height: 22px;
  color: #1f2937;
}

.sg-wavy-thinking-line {
  font-size: var(--gf-text-small);
  line-height: 22px;
  color: #1f2937;
}

.sg-wavy-thinking-bullets {
  margin: 6px 0 0;
  padding-left: 18px;
  display: block;
  list-style: disc;
  font-size: var(--gf-text-small);
  line-height: 22px;
  color: #1f2937;
}

.sg-wavy-thinking-bullets li::marker {
  color: #98a2b3;
}

.sg-wavy-thinking-caret {
  display: inline-block;
  width: 2px;
  height: 16px;
  margin-left: 2px;
  vertical-align: -3px;
  background: #3366e8;
  animation: sg-wavy-dc-caret 1s steps(1) infinite;
}

/* streaming layout: compact badges, labels in caps, the live step highlighted */
.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-step {
  gap: 10px;
}

.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-step-rail {
  width: 22px;
}

.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-step-num {
  width: 22px;
  height: 22px;
  border-radius: 11px;
  font-size: var(--gf-text-chip);
  background: #e8eeff;
  color: #2f4fb8;
  box-shadow: none;
}

.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-step-line {
  display: none;
}

.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-step-card {
  margin-bottom: 0;
  border-color: #e6ebf5;
  background: #ffffff;
}

.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-step-title {
  font-size: var(--gf-text-chip);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #111827;
}

.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-step-hint {
  flex: 1;
  color: #5b6577;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-step-text,
.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-bullets {
  margin-top: 8px;
  padding-left: 32px;
}

.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-step.is-active .sg-wavy-thinking-step-card {
  border-color: #c9d8fb;
  background: linear-gradient(135deg, #f1f5ff 0%, #e6eeff 100%);
}

.sg-wavy-thinking-panel[data-state="streaming"] .sg-wavy-thinking-step.is-active .sg-wavy-thinking-step-num {
  background: linear-gradient(135deg, #7497ef 0%, #3366e8 100%);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(51, 102, 232, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .sg-wavy-thinking-panel .sg-wavy-thinking-dot,
  .sg-wavy-thinking-progress-bar,
  .sg-wavy-thinking-caret,
  .sg-wavy-thinking-orb-ring {
    animation: none !important;
  }
}

/* ==========================================
   Media Cards (Image / Video)
   ========================================== */
.sg-wavy-media-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* Half the width of the message column. A generated image at full width pushed the composer off
   the fold and made the answer unreadable next to it. */
.sg-wavy-generated-image {
  max-width: min(320px, 100%);
  max-height: 320px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  cursor: zoom-in;
}
.sg-wavy-generated-video {
  max-width: 100%;
  border-radius: 8px;
}

.sg-wavy-chat-image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
  z-index: 120000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.sg-wavy-chat-image-lightbox.active {
  display: flex;
}

.sg-wavy-chat-image-lightbox-panel {
  position: relative;
  max-width: min(92vw, 1200px);
  max-height: 92vh;
}

.sg-wavy-chat-image-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 92vh;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.sg-wavy-chat-image-lightbox-topbar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

.sg-wavy-chat-image-menu-btn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: var(--gf-text-card);
  line-height: 1;
  cursor: pointer;
}

.sg-wavy-chat-image-menu {
  position: absolute;
  top: 42px;
  right: 0;
  min-width: 130px;
  background: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16);
  padding: 6px;
  display: none;
}

.sg-wavy-chat-image-menu.active {
  display: block;
}

.sg-wavy-chat-image-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  color: #111827;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: var(--gf-text-caption);
  cursor: pointer;
}

.sg-wavy-chat-image-menu-item:hover {
  background: #f3f4f6;
}

/* ── Media generation loading placeholder ── */
.sg-wavy-media-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 16px;
  min-height: 180px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
  border: 1px dashed #b2ccff;
}
.sg-wavy-media-placeholder p {
  margin: 0;
  font-size: var(--gf-text-body);
  color: #2966f4;
  font-weight: var(--gf-weight-medium);
}
.sg-wavy-media-placeholder p.sg-wavy-media-progress {
  font-size: var(--gf-text-caption);
  color: #667085;
}
.sg-wavy-media-bar {
  width: min(100%, 320px);
  height: 8px;
  border-radius: 999px;
  background: #d1e0ff;
  overflow: hidden;
}
.sg-wavy-media-bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2966f4 0%, #2054cc 100%);
  transition: width 300ms cubic-bezier(0.2, 0, 0, 1);
}
.sg-wavy-media-cancel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d0d5dd;
  background: #ffffff;
  color: #475467;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
  line-height: 1;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}
.sg-wavy-media-cancel:hover {
  background: #f9fafb;
  border-color: #98a2b3;
  color: #344054;
}
.sg-wavy-media-cancel:disabled {
  opacity: 0.6;
  cursor: default;
}
.sg-wavy-media-canceled {
  margin: 0;
  font-size: var(--gf-text-caption);
  color: #475467;
}
.sg-wavy-media-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #d1e0ff;
  border-top-color: #2966f4;
  border-radius: 50%;
  animation: sgWavySpin 0.8s linear infinite;
}
@keyframes sgWavySpin {
  to {
    transform: rotate(360deg);
  }
}

.recording-tools {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.text-input {
  width: 100%;
  padding: 16px 20px;
  border-radius: 16px;
  border: none;
  background: white;
  font-size: var(--gf-text-body);
  outline: none;
  margin-top: 30px;
}

.send-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: #2054cc;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--gf-text-section);
  margin-top: 20px;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}

.send-btn:hover {
  background: #2054cc;
  transform: scale(1.05);
}

.recording-interface {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

.ai_modal.fullwidth-mode .recording-interface {
  width: 100%;
  justify-content: center;
}

.recording-tools button {
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 50%;
  border: none;
  font-size: var(--gf-text-card);

  width: 50px;
  height: 50px;
}

.toggle-mic-btn {
  background: white;
}

.done-with-mic-btn {
  background: linear-gradient(to top right, #2966f4, #2054cc);
  color: white;
}

.history-list {
  width: 100%;
  text-align: left;
  overflow-y: auto;
  max-height: 500px;

  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.history-section {
  margin-bottom: 15px;
}

.history-section h3 {
  font-size: var(--gf-text-caption);
  color: #667085;
  margin-bottom: 5px;
  font-weight: var(--gf-weight-medium);
}

.sg-wavy-history-item {
  margin-bottom: 5px;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
  font-size: var(--gf-text-caption);
  color: #101828;

  display: flex;
  align-items: center;
  gap: 10px;
}

.sg-wavy-history-item .item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
}

.sg-wavy-history-item .item-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trash-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--gf-text-card);
}

.step-indicator {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  transition: all 240ms cubic-bezier(0.2, 0, 0, 1);
}

.step-dot.active {
  background: #2054cc;
  width: 24px;
  border-radius: 4px;
}

.slideFadeIn {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sg-wavy-modal-overviews {
  display: none;
  max-height: 100%;
}

.ai_modal.sidebar-mode .sg-wavy-modal-overviews {
  display: grid;
  gap: 10px;

  margin: 15px 0;
}

.sg-wavy-modal-overview-item {
  background: #d1d1d153;
  border-radius: 20px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.sg-wavy-modal-overview-item h3 {
  display: flex;
  align-items: center;
  gap: 10px;

  font-size: var(--gf-text-card);
  color: #101828;
  font-weight: var(--gf-weight-semibold);
  margin-bottom: 6px;
}

.ai_modal.fullwidth-mode .sg-wavy-modal-overview-item h3 svg {
  display: none;
}

.sg-wavy-modal-overview-item p {
  color: #344054;
  font-weight: var(--gf-weight-regular);
  font-size: var(--gf-text-body);
}

.ai_modal.fullwidth-mode .sg-wavy-modal-overview-item p {
  margin-bottom: 12px;
}

.sg-wavy-learn-more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;

  width: 100%;
}

.ai_modal.sidebar-mode .sg-wavy-learn-more {
  display: none;
}

.sg-wavy-learn-more a {
  text-decoration: none;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-medium);
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);

  background: linear-gradient(90deg, #2966f4 0%, #2054cc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.sg-wavy-learn-more:hover {
  color: #2054cc;
}

.sg-wavy-learn-more span {
  padding: 4px 20px;
  background: #ffffff;
  border-radius: 30px;
}

/**----------------------------------------   FULL WIDTH MODAL -----------------------------------*/

/* Disable transitions while switching between fullwidth ↔ widget mode */
.ai_modal.mode-transition {
  transition: none !important;
}

/* Full-width mode */
.ai_modal.fullwidth-mode {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: calc(100vw - 40px) !important;
  max-width: 1400px !important;
  height: calc(100vh - 100px) !important;
  border-radius: 20px;
  z-index: 10000;
}

.ai_modal.fullwidth-mode .ai_modal_wrapper {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
  gap: 0;
  height: 100%;

  padding: 15px !important;
}

/* In gallery mode, remove right wrapper inset so search can sit at the extreme right */
.ai_modal.fullwidth-mode.gallery-active .ai_modal_wrapper {
  padding-right: 0 !important;
}

.ai_modal.fullwidth-mode .modal-header {
  grid-column: 2;
  grid-row: 1;

  padding: 0 10px;
}

/* Hide the main header/navbar when gallery is open */
.ai_modal.gallery-active .modal-header {
  display: none !important;
}

.ai_modal.fullwidth-mode .sg-wavy-fullwidth-sidebar {
  grid-column: 1;
  grid-row: 1 / -1;
}

.ai_modal.fullwidth-mode .modal-content,
.ai_modal.fullwidth-mode .gallery-modal-overlay {
  grid-column: 2;
  grid-row: 2;
  padding: 20px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Gallery content is intentionally separated from the shared content rule above */
.ai_modal.fullwidth-mode .gallery-content {
  grid-column: 2;
  padding: 0;
  overflow: hidden;
}

/* When gallery is active, content area stays in row 2 (header is lifted out by JS) */
.ai_modal.fullwidth-mode.gallery-active .gallery-content {
  grid-row: 2;
  overflow-y: auto;
  padding: 10px 10px 20px 10px;
}

/* Gallery header when lifted into the grid (data-grid-lifted attr set by gallery.js) */
.ai_modal.fullwidth-mode .gallery-header[data-grid-lifted] {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 10px;
  margin-bottom: 0;
  min-height: 56px;
  box-sizing: border-box;
  overflow: visible;
}

/* Left block (back btn + title) takes all remaining space */
.ai_modal.fullwidth-mode .gallery-header[data-grid-lifted] > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Search pins to extreme right */
.ai_modal.fullwidth-mode .gallery-header[data-grid-lifted] .gallery-search {
  flex: 0 0 auto;
  margin-left: auto;
  margin-right: 0;
  position: static;
}

/* #galleryContent without the header only needs row 2 */
.ai_modal.fullwidth-mode #galleryContent {
  padding: 10px 10px 20px 10px;
  overflow-y: auto;
}

/* Sidebar for full-width mode */
.sg-wavy-fullwidth-sidebar {
  display: none;
  border: 1px solid #d0d5dd;
  background: #ffffff;

  padding: 0px;
  overflow-y: auto;
  border-radius: 20px;
  scrollbar-width: none;
}

.ai_modal.fullwidth-mode .sg-wavy-fullwidth-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sg-wavy-fullwidth-sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 10px;
  border-radius: 20px 20px 0 0;

  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  backdrop-filter: blur(5px);
}

.sg-wavy-fullwidth-sidebar-header .gradient-orb {
  flex: 0 0 24px;
  width: 24px !important;
  height: 24px !important;
  min-width: 24px;
  min-height: 24px !important;
}

.sg-wavy-fullwidth-sidebar-header h2 {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  font-size: var(--gf-text-card);
  font-weight: var(--gf-weight-semibold);
  color: #101828;
}

.sg-wavy-fullwidth-sidebar-header .version {
  flex: 0 0 auto;
  font-size: var(--gf-text-body);
  color: #667085;
  font-weight: var(--gf-weight-medium);
  margin-left: auto;
}

/* Sidebar options menu */
.sg-wavy-sidebar-options {
  display: block;
  position: relative;
  border: none;
  background: #ffffff;
  padding: 7px;
  width: 100%;

  top: 0;
  left: 0;
}

.sg-wavy-sidebar-options li {
  padding-left: 4px;
  padding-right: 4px;
  border-radius: 5px !important;
}

.sg-wavy-sidebar-options li:hover {
  border-radius: 5px !important;
}

.sg-wavy-fullwidth-sidebar-history-header {
  margin-bottom: 10px;
  padding: 0 10px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-regular);
}

.sg-wavy-fullwidth-sidebar-history-header div {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sg-wavy-fullwidth-sidebar-section {
  margin-bottom: 10px;
  padding: 0 10px;
}

.sg-wavy-fullwidth-sidebar-section h3 {
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-semibold);
  color: #667085;
  margin-bottom: 8px;
  padding: 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sg-wavy-fullwidth-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
  font-size: var(--gf-text-body);
  color: #344054;
}

.sg-wavy-fullwidth-sidebar-item:hover {
  background: #f9fafb;
}

.sg-wavy-fullwidth-sidebar-item.active {
  background: #d1e0ff;
  color: #2054cc;
  font-weight: var(--gf-weight-medium);
}

.sg-wavy-fullwidth-sidebar-item svg {
  flex-shrink: 0;
}

.sg-wavy-fullwidth-sidebar-item .item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
}

.sg-wavy-fullwidth-sidebar-item .item-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sg-wavy-fullwidth-sidebar-item .item-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sg-wavy-fullwidth-sidebar-item .item-badge {
  background: #f2f4f7;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: var(--gf-text-caption);
  color: #667085;
  font-weight: var(--gf-weight-medium);
}

.wavy-chat-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--gf-text-body);
  line-height: 1;
  color: #98a2b3;
  padding: 0 4px;
  border-radius: 6px;
  opacity: 0;
  transition:
    opacity 160ms cubic-bezier(0.2, 0, 0, 1),
    background 160ms cubic-bezier(0.2, 0, 0, 1),
    color 160ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-fullwidth-sidebar-item:hover .wavy-chat-menu-btn,
.sg-wavy-fullwidth-sidebar-item.active .wavy-chat-menu-btn {
  opacity: 1;
}

.wavy-chat-menu-btn:hover {
  background: #f2f4f7;
  color: #344054;
}

.history-item-menu-sm {
  background: none;
  border: none;
  cursor: pointer;
  color: #98a2b3;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: var(--gf-text-body);
  line-height: 1;
  flex-shrink: 0;
}

.history-item-menu-sm:hover {
  background: #f2f4f7;
  color: #344054;
}

/* Full-width content area */
.ai_modal.fullwidth-mode .sg-wavy-initial-content {
  height: auto;
  padding: 40px 0;
}

.ai_modal.fullwidth-mode .sg-wavy-modal-overviews {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-top: 30px;
}

.ai_modal.fullwidth-mode .sg-wavy-text-voice .input-container {
  max-width: 600px;
  margin: 40px auto 0;
}

/* Close button outside modal (desktop only) */
.sg-wavy-fullwidth-close-outside {
  display: none;
  position: absolute;
  top: -40px;
  left: -10px;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: white;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
  z-index: 10003;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ai_modal.fullwidth-mode .sg-wavy-fullwidth-close-outside {
  display: flex;
  top: -40px;
  left: -10px;
  z-index: 10003;
}

.sg-wavy-fullwidth-close-outside:hover {
  background: #f9fafb;
  border-color: #d0d5dd;
}

/* Hide on mobile */
@media (max-width: 768px) {
  .sg-wavy-fullwidth-close-outside {
    display: none !important;
  }
}

/* Backdrop for full-width mode */
.sg-wavy-fullwidth-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  transition: opacity 240ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-fullwidth-backdrop.active {
  display: block;
  opacity: 1;
}

/* Responsive adjustments for full-width mode */
@media (max-width: 768px) {
  .ai_modal.fullwidth-mode {
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 60px) !important;
  }

  .ai_modal.fullwidth-mode .ai_modal_wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .ai_modal.fullwidth-mode .sg-wavy-fullwidth-sidebar {
    display: none;
  }

  .ai_modal.fullwidth-mode .modal-header {
    grid-column: 1;
    grid-row: 1;
    border-radius: 20px 20px 0 0;
  }

  .ai_modal.fullwidth-mode .modal-content {
    grid-column: 1;
    grid-row: 2;
  }

  /* Show mobile menu, hide desktop header elements */
  .ai_modal.fullwidth-mode .sg-wavy-mobile-menu {
    display: flex;
  }

  .ai_modal.fullwidth-mode .sg-wavy-header-search,
  .ai_modal.fullwidth-mode .sg-wavy-header-actions {
    display: none;
  }

  .ai_modal.fullwidth-mode .tone-selector,
  .ai_modal.fullwidth-mode .sg-wavy-external-btn {
    display: flex;
  }
}

/* Scrollbar styling for sidebar */
.sg-wavy-fullwidth-sidebar::-webkit-scrollbar {
  width: 6px;
}

.sg-wavy-fullwidth-sidebar::-webkit-scrollbar-track {
  background: #f9fafb;
}

.sg-wavy-fullwidth-sidebar::-webkit-scrollbar-thumb {
  background: #d0d5dd;
  border-radius: 3px;
}

.sg-wavy-fullwidth-sidebar::-webkit-scrollbar-thumb:hover {
  background: #98a2b3;
}

/* ============================================
   Red Orb State (Colloquial Toggle OFF)
   Only affects gradient-orb inside AI modal
   ============================================ */

.gradient-orb.orb-red {
  /* background: linear-gradient(135deg, #ff0000 0%, #cc0000 50%, #ff4444 100%) !important; */
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 50%, #ff0000 100%);
  animation: pulseRed 3s ease-in-out infinite !important;
}

@keyframes pulseRed {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
  }
}

/* ============================================
   Chat Message Edit Functionality
   ============================================ */

.sg-wavy-chat-action-btn.copied {
  color: #10b981;
}

/* TTS inline play/pause button */
.sg-wavy-tts-btn[data-tts-state="playing"] {
  color: #2966f4;
}
.sg-wavy-tts-btn[data-tts-state="playing"] svg path,
.sg-wavy-tts-btn[data-tts-state="playing"] svg rect {
  fill: #2966f4;
}
.sg-wavy-tts-btn[data-tts-state="paused"] {
  color: #f59e0b;
}
.sg-wavy-tts-btn[data-tts-state="paused"] svg path {
  fill: #f59e0b;
}
.sg-wavy-tts-btn[data-tts-state="loading"] {
  opacity: 0.5;
  pointer-events: none;
}

.sg-wavy-edit-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: auto;
  max-width: 100%;
  align-items: flex-end;
  width: 100%;
}

.sg-wavy-edit-textarea {
  width: 100%;
  max-width: 70%;
  padding: 6px 12px;
  border-radius: 8px;
  border: 2px solid var(--gf-blue);
  background: #f9fafb;
  font-size: var(--gf-text-body);
  font-family: inherit;
  line-height: var(--gf-leading-body);
  color: #344054;
  caret-color: #2966f4;
  resize: none;
  outline: none;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: none;
  box-sizing: border-box;
}

.sg-wavy-edit-textarea:focus {
  border-color: var(--gf-blue);
  background: white;
}

.sg-wavy-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.sg-wavy-edit-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-edit-save {
  background: linear-gradient(to top right, #2966f4, #2054cc);
  color: white;
}

.sg-wavy-edit-save:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px #4d4bfe4d;
}

.sg-wavy-edit-cancel {
  background: #f2f4f7;
  color: #667085;
}

.sg-wavy-edit-cancel:hover {
  background: #e5e7eb;
  color: #344054;
}

/* Scrollbar for edit textarea */
.sg-wavy-edit-textarea::-webkit-scrollbar {
  width: 4px;
}

.sg-wavy-edit-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.sg-wavy-edit-textarea::-webkit-scrollbar-thumb {
  background: #d0d5dd;
  border-radius: 2px;
}

.sg-wavy-edit-textarea::-webkit-scrollbar-thumb:hover {
  background: #98a2b3;
}

.ai_modal.sidebar-mode .history-section h3,
.ai_modal.sidebar-mode .sg-wavy-history-item {
  font-size: var(--gf-text-body);
}

.sg-wavy-fullwidth-sidebar-gallery-header,
.sg-wavy-fullwidth-sidebar-folder-header {
  display: flex;
  align-items: center;
  gap: 7px;

  font-size: var(--gf-text-body);
  padding: 0 10px;
  margin-bottom: 6px;
}

.sg-wavy-fullwidth-sidebar-gallery-header span:last-child:not(:nth-child(2)),
.sg-wavy-fullwidth-sidebar-folder-header span:last-child:not(:nth-child(2)) {
  margin-left: auto;
}

/* Gallery count badge in sidebar */
.sg-wavy-gallery-count-badge {
  margin-left: auto !important;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-semibold);
  color: #667085;
  min-width: 18px;
  text-align: right;
}

/* Sidebar empty state messages */
.sg-wavy-sidebar-gallery-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  gap: 0;
}

.sg-wavy-sidebar-history-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  gap: 6px;
}

.sg-wavy-sidebar-gallery-empty svg,
.sg-wavy-sidebar-history-empty svg {
  margin-bottom: 4px;
  opacity: 0.45;
}

.sg-wavy-sidebar-gallery-empty p,
.sg-wavy-sidebar-history-empty p {
  margin: 0;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-semibold);
  color: #424855;
}

.sg-wavy-sidebar-gallery-empty span,
.sg-wavy-sidebar-history-empty span {
  font-size: var(--gf-text-caption);
  color: #7a8395;
  line-height: var(--gf-leading-caption);
}

/* Empty-state action buttons (Type to Wavy / Speak to Wavy) */
.sg-wavy-empty-type-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #f2f4f7;
  color: #4e5561;
  border: none;
  border-radius: 50px;
  padding: 9px 18px;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
  cursor: pointer;
  margin-top: 10px;
  width: 100%;
  box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.07);
  transition: background 160ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-empty-type-btn:hover {
  background: #e8eaed;
}

.sg-wavy-empty-speak-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(to right, #2966f4, #2966f4);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 9px 18px;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
  cursor: pointer;
  flex: 1;
  box-shadow: 2px 4px 10px rgba(41, 112, 255, 0.3);
  transition: opacity 160ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-empty-speak-btn:hover {
  opacity: 0.9;
}

.sg-wavy-empty-btns {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 380px;
  margin-top: 14px;
}

.sg-wavy-empty-btns .sg-wavy-empty-type-btn {
  margin-top: 0;
  flex: 1;
}

/* ── Chat-area centered empty state (matches screenshot spec) ── */
.sg-wavy-chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  min-height: 300px;
  padding: 60px 20px;
  gap: 10px;
  pointer-events: none;
  user-select: none;
}

.sg-wavy-chat-empty-state svg {
  margin-bottom: 12px;
  opacity: 0.5;
}

.sg-wavy-chat-empty-state p {
  margin: 0;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  color: #424855;
}

.sg-wavy-chat-empty-state span {
  font-size: var(--gf-text-caption);
  color: #8b96a6;
  line-height: var(--gf-leading-caption);
}

/* ── Gallery content-area empty state (matches screenshot spec) ── */
.sg-wavy-gallery-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  min-height: 400px;
  padding: 60px 20px;
  gap: 8px;
}

.sg-wavy-gallery-empty-state svg {
  margin-bottom: 8px;
  opacity: 0.45;
}

.sg-wavy-gallery-empty-state p {
  margin: 0;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  color: #424855;
}

.sg-wavy-gallery-empty-state h3 {
  margin: 0;
  font-size: var(--gf-text-card);
  font-weight: var(--gf-weight-semibold);
  color: #424855;
}

.sg-wavy-purple-text {
  background: linear-gradient(to right, #2966f4, #2966f4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sg-wavy-gallery-empty-state span {
  font-size: var(--gf-text-caption);
  color: #7a8395;
  line-height: var(--gf-leading-caption);
}

/* Gallery Styles */
.gallery-content {
  margin-left: 0 !important;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  gap: 16px;
  min-height: 56px;
  padding: 0;
  width: 100%;

  color: #101828;
}

.gallery-header > div {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.gallery-header > div:first-child {
  flex: 1;
  min-width: 0;
  padding-right: 0;
}

.gallery-header > div:last-child {
  margin-left: auto;
}

.gallery-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #101828;
  font-size: var(--gf-text-body);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 30px;
  background: #f2f4f7;
}

.gallery-header h2 {
  font-size: var(--gf-text-card);
  font-weight: var(--gf-weight-semibold);
  color: #101828;
  margin: 0;
}

.gallery-search {
  display: flex;
  align-items: center;
  background: #98a2b338;
  border-radius: 20px;
  padding: 8px 12px;
  gap: 8px;
  min-width: 300px;
  margin-left: auto !important;
  margin-right: 0 !important;
  flex-shrink: 0;
  position: static;
  transform: none;
}

.gallery-search input {
  border: none;
  outline: none;
  font-size: var(--gf-text-body);
  color: #101828;
  background: transparent;
  width: 100%;
}

.gallery-search input::placeholder {
  color: #667085;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.gallery-grid:empty {
  display: none;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.2, 0, 0, 1);
}

.gallery-item:hover {
  transform: scale(1.02);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  opacity: 0;
  transition: opacity 160ms cubic-bezier(0.2, 0, 0, 1);
  padding: 5px;
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}

.gallery-item-expand,
.gallery-item-download {
  background: var(--gf-blue);
  cursor: pointer;
  padding: 2px;
  width: 30px;
  height: 30px;
  border-radius: 100%;

  display: flex;
  justify-content: center;
  align-items: center;
}

.gallery-item-expand {
  background: #ffffff;
}

/* Gallery Modal Styles */
.gallery-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 130000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px !important;
  margin: 0 !important;
  border-radius: 0;
  overflow: auto;
  background: rgba(16, 24, 40, 0.86);
}
.gallery-modal-content {
  border-radius: 12px;
  width: min(1100px, 96vw);
  max-height: 92vh;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #101828;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.gallery-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
}

.gallery-modal-header-action {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gallery-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 160ms cubic-bezier(0.2, 0, 0, 1);
}

.gallery-modal-close:hover {
  background: #ffffff1a;
}

.gallery-modal-header h3 {
  color: white;
  font-size: var(--gf-text-card);
  font-weight: var(--gf-weight-semibold);
  margin: 0;
}

.gallery-modal-actions {
  display: flex;
  gap: 12px;
}

.gallery-modal-share,
.gallery-modal-download {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gf-blue);
  border: none;
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: var(--gf-text-body);
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.2, 0, 0, 1);
}

.gallery-modal-share {
  background: #475467;
}

.gallery-modal-share:hover,
.gallery-modal-download:hover {
  transform: translateY(-1px);
}

.gallery-modal-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 10px;
  min-height: 0;
}

.gallery-modal-image-container img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.gallery-modal-thumbnails {
  padding: 10px;
  flex-shrink: 0;
  height: 70px;
}

.gallery-thumbnails-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  justify-content: center;
  align-items: center;
}

.gallery-thumbnails-container::-webkit-scrollbar {
  height: 4px;
}

.gallery-thumbnails-container::-webkit-scrollbar-track {
  background: #374151;
  border-radius: 2px;
}

.gallery-thumbnails-container::-webkit-scrollbar-thumb {
  background: #6b7280;
  border-radius: 2px;
}

.gallery-thumbnails-container::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.gallery-thumbnail {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
  flex-shrink: 0;
  opacity: 0.6;
}

.gallery-thumbnail:hover {
  opacity: 0.8;
  transform: scale(1.05);
}

.gallery-thumbnail.active {
  border-color: #2966f4;
  opacity: 1;
  transform: scale(1.1);
}

.gallery-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Responsive Design */
@media (max-width: 768px) {
  .ai_modal.fullwidth-mode #galleryContent .gallery-header {
    position: static;
  }

  .ai_modal.fullwidth-mode #galleryContent .gallery-header > div:first-child {
    padding-right: 0;
  }

  .ai_modal.fullwidth-mode #galleryContent .gallery-search {
    position: static;
    top: auto;
    right: auto;
    transform: none;
  }

  .gallery-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .gallery-header > div:first-child {
    padding-right: 0;
  }

  .gallery-search {
    min-width: auto;
    position: static;
    transform: none;
  }

  .gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }

  .gallery-modal-content {
    margin: 10px;
    max-height: calc(100vh - 20px);
  }

  .gallery-modal-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .gallery-modal-actions {
    justify-content: center;
  }
}

/* ─── Recording Pulse Animation ───────────────────────── */
.gradient-orb.recording-pulse {
  animation: recordingPulse 1s ease-in-out infinite !important;
  box-shadow: 0 0 0 0 rgba(245, 87, 108, 0.5);
}

@keyframes recordingPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 87, 108, 0.5);
  }
  50% {
    transform: scale(1.12);
    box-shadow: 0 0 0 20px rgba(245, 87, 108, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 87, 108, 0);
  }
}

/* ─── Speaking (TTS playback) Pulse Animation ─────────── */
.gradient-orb.speaking-pulse {
  animation: speakingPulse 0.8s ease-in-out infinite !important;
  box-shadow: 0 0 0 0 rgba(41, 112, 255, 0.5);
}

@keyframes speakingPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(41, 112, 255, 0.5);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 16px rgba(41, 112, 255, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(41, 112, 255, 0);
  }
}

/* ─── Speak-to-Wavy Status Text ──────────────────────── */
.sg-wavy-speak-status {
  text-align: center;
  font-size: var(--gf-text-caption);
  color: #9ca3af;
  margin-top: 12px;
  min-height: 20px;
  transition:
    color 160ms cubic-bezier(0.2, 0, 0, 1),
    opacity 160ms cubic-bezier(0.2, 0, 0, 1);
}

.sg-wavy-speak-status:empty {
  opacity: 0;
}

/* ─── History Item Meta & Delete ──────────────────────── */
.history-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: var(--gf-text-caption);
  color: #9ca3af;
}

.history-item-delete {
  opacity: 0;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: var(--gf-text-caption);
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
  line-height: 1;
}

.history-item:hover .history-item-delete {
  opacity: 1;
}

.history-item-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* =============================================
   FOLDER SYSTEM — Sidebar + Context Menu + Folder View
   ============================================= */

/* Folder group in sidebar */
.wavy-folder-group {
  margin: 6px 8px;
}

.wavy-folder-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #eaecf0;
  background: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-medium);
  color: #344054;
  transition: background 160ms cubic-bezier(0.2, 0, 0, 1);
}
.wavy-folder-header:hover {
  background: #f3f4f6;
}
.wavy-folder-header.active {
  background: #eff4ff;
  color: #2966f4;
}
.wavy-folder-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wavy-folder-count {
  font-size: var(--gf-text-caption);
  color: #9ca3af;
  min-width: 18px;
  text-align: center;
}
.wavy-folder-chevron {
  transition: transform 160ms cubic-bezier(0.2, 0, 0, 1);
  flex-shrink: 0;
}
.wavy-folder-header.active .wavy-folder-chevron {
  transform: rotate(90deg);
}
.wavy-folder-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--gf-text-body);
  color: #9ca3af;
  padding: 0 4px;
  line-height: 1;
  opacity: 0;
  transition: opacity 160ms cubic-bezier(0.2, 0, 0, 1);
}
.wavy-folder-header:hover .wavy-folder-menu-btn {
  opacity: 1;
}

/* Folder chats container (collapsible) */
.wavy-folder-chats {
  max-height: 0;
  overflow: hidden;
  transition: max-height 240ms cubic-bezier(0.2, 0, 0, 1);
  padding-left: 16px;
  border-left: 2px solid #e5e7eb;
  margin: 4px 0 0 16px;
}
.wavy-folder-chats.expanded {
  max-height: 600px;
  overflow-y: auto;
  padding-top: 4px;
  padding-bottom: 4px;
}
.wavy-folder-new-chat {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px dashed #d0d5dd;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: var(--gf-text-caption);
  color: #667085;
  cursor: pointer;
  margin-bottom: 4px;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}
.wavy-folder-new-chat:hover {
  background: #f9fafb;
  border-color: #2966f4;
  color: #2966f4;
}
.wavy-folder-empty {
  padding: 6px 10px;
  font-size: var(--gf-text-caption);
  color: #9ca3af;
  font-style: italic;
  margin: 0;
}

/* Context menu */
.wavy-context-menu {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 4px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  font-size: var(--gf-text-caption);
  animation: ctxFadeIn 0.12s ease;
}
@keyframes ctxFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.wavy-ctx-item {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: #344054;
  transition: background 160ms cubic-bezier(0.2, 0, 0, 1);
}
.wavy-ctx-item:hover {
  background: #f3f4f6;
}
.wavy-ctx-item.disabled {
  color: #d0d5dd;
  pointer-events: none;
}
.wavy-ctx-divider {
  height: 1px;
  background: #f3f4f6;
  margin: 4px 8px;
}
.wavy-ctx-label {
  padding: 6px 12px 2px;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9ca3af;
}

/* Folder view panel */
.wavy-folder-view {
  padding: 24px 32px;
  overflow-y: auto;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  box-sizing: border-box;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
  height: 100%;
}
.wavy-folder-view.homepage-hidden,
.wavy-folder-view.work-hidden,
.wavy-folder-view.is-hidden,
.wavy-folder-view[hidden] {
  display: none !important;
}
.wavy-folder-view-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f2f4f7;
}
.wavy-folder-view-header h2 {
  font-size: var(--gf-text-card);
  font-weight: var(--gf-weight-semibold);
  color: #101828;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wavy-folder-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
  cursor: pointer;
  color: #344054;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}
.wavy-folder-back-btn:hover {
  background: #f9fafb;
  border-color: #98a2b3;
  color: #101828;
}
.wavy-folder-view-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.wavy-folder-field label {
  display: block;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-semibold);
  color: #344054;
  margin-bottom: 6px;
}
.wavy-folder-field textarea {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: var(--gf-text-body);
  font-family: inherit;
  color: #344054;
  resize: vertical;
  outline: none;
  transition: border-color 160ms cubic-bezier(0.2, 0, 0, 1);
  box-sizing: border-box;
}
.wavy-folder-field textarea:focus {
  border-color: #2966f4;
}
.wavy-folder-files,
.wavy-folder-chat-list {
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  padding: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.wavy-folder-file-item,
.wavy-folder-chat-item {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: var(--gf-text-caption);
  color: #344054;
  cursor: pointer;
  transition: background 160ms cubic-bezier(0.2, 0, 0, 1);
}
.wavy-folder-file-item:hover,
.wavy-folder-chat-item:hover {
  background: #f3f4f6;
}

.wavy-folder-file-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.wavy-folder-file-input {
  max-width: 100%;
  font-size: var(--gf-text-caption);
  color: #475467;
}

.wavy-folder-upload-btn,
.wavy-folder-file-delete {
  border: 0;
  border-radius: 999px;
  background: #2966f4;
  color: #fff;
  padding: 7px 12px;
  font: inherit;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-semibold);
  cursor: pointer;
}

.wavy-folder-upload-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.wavy-folder-upload-status {
  color: #667085;
  font-size: var(--gf-text-caption);
}

.wavy-folder-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wavy-folder-file-delete {
  background: #fff;
  border: 1px solid #d0d5dd;
  color: #b42318;
}
.wavy-rag-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
  background: #f3f4f6;
  color: #667085;
}
.wavy-rag-badge.active {
  background: #ecfdf5;
  color: #059669;
}
.wavy-folder-save-btn {
  background: linear-gradient(to right, #2966f4, #2054cc);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  cursor: pointer;
  transition: opacity 160ms cubic-bezier(0.2, 0, 0, 1);
}
.wavy-folder-save-btn:hover {
  opacity: 0.9;
}
.wavy-folder-new-chat-btn {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: var(--gf-text-body);
  color: #344054;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}
.wavy-folder-new-chat-btn:hover {
  background: #f3f4f6;
}

/* ─── Gallery Filter Tabs ───────────────────────────── */
.gallery-filter-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
}
.gallery-filter-tab {
  padding: 6px 16px;
  border: none;
  border-radius: 8px;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
  background: #2d3040;
  color: #9ca3af;
}
.gallery-filter-tab:hover {
  background: #3d4050;
  color: #e5e7eb;
}
.gallery-filter-tab.active {
  background: #2966f4;
  color: #fff;
}

/* ─── Gallery Card Grid ─────────────────────────────── */
.gallery-card {
  background: #1a1d27;
  border-radius: 12px;
  border: 1px solid #2d3040;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    transform 160ms cubic-bezier(0.2, 0, 0, 1),
    box-shadow 160ms cubic-bezier(0.2, 0, 0, 1);
}
.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.gallery-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: #0f1117;
}
.gallery-card-thumb img,
.gallery-card-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 240ms cubic-bezier(0.2, 0, 0, 1);
}
.gallery-card:hover .gallery-card-thumb img,
.gallery-card:hover .gallery-card-thumb video {
  transform: scale(1.05);
}

.gallery-card-thumb-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 160ms cubic-bezier(0.2, 0, 0, 1),
    transform 160ms cubic-bezier(0.2, 0, 0, 1);
  z-index: 3;
}

.gallery-card:hover .gallery-card-thumb-actions {
  opacity: 1;
  transform: translateY(0);
}

.gallery-thumb-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--gf-text-body);
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.18);
  transition:
    transform 160ms cubic-bezier(0.2, 0, 0, 1),
    opacity 160ms cubic-bezier(0.2, 0, 0, 1);
}

.gallery-thumb-action-btn:hover {
  transform: scale(1.06);
}

.gallery-thumb-action-btn.expand {
  background: #ffffff;
  color: #111827;
}

.gallery-thumb-action-btn.download {
  background: #2054cc;
  color: #ffffff;
}

.gallery-thumb-action-btn.delete {
  background: #ef4444;
  color: #ffffff;
}
.gallery-card-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--gf-text-title-section);
  background: rgba(0, 0, 0, 0.5);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.gallery-version-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(41, 112, 255, 0.9);
  color: #fff;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-semibold);
  padding: 2px 8px;
  border-radius: 6px;
}
.gallery-card-info {
  padding: 10px 12px 6px;
}
.gallery-card-prompt {
  font-size: var(--gf-text-caption);
  color: #d1d5db;
  line-height: var(--gf-leading-caption);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  margin: 0;
}
.gallery-card-meta {
  font-size: var(--gf-text-caption);
  color: #6b7280;
  margin-top: 2px;
  display: block;
}
.gallery-card-actions {
  display: flex;
  gap: 4px;
  padding: 4px 10px 10px;
}
.gallery-action-btn {
  flex: 1;
  background: none;
  border: 1px solid #2d3040;
  border-radius: 6px;
  padding: 6px;
  font-size: var(--gf-text-body);
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
  text-align: center;
}
.gallery-action-btn:hover {
  background: #2d3040;
}

/* Gallery Load More */
.gallery-load-more-container {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 20px 0;
}
.gallery-load-more-btn {
  background: #2d3040;
  color: #e5e7eb;
  border: 1px solid #3d4050;
  border-radius: 10px;
  padding: 10px 32px;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}
.gallery-load-more-btn:hover {
  background: #3d4050;
}

/* ─── Gallery Lightbox Details ──────────────────────── */
.gallery-lightbox-details {
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 700px;
  margin: 0 auto;
}
.gallery-detail-row {
  font-size: var(--gf-text-caption);
  color: #9ca3af;
  line-height: var(--gf-leading-caption);
}
.gallery-detail-row strong {
  color: #e5e7eb;
  margin-right: 4px;
}
.gallery-goto-chat-btn {
  background: #2d3040;
  color: #84adff;
  border: 1px solid #3d4050;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: var(--gf-text-caption);
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}
.gallery-goto-chat-btn:hover {
  background: #3d4050;
  color: #b2ccff;
}

/* ─── Toast Notification ────────────────────────────── */
.wavy-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  color: #e5e7eb;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-medium);
  border: 1px solid #334155;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: all 240ms cubic-bezier(0.2, 0, 0, 1);
  z-index: 2147483647;
}
.wavy-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ─── Imported (Shared with you) Sidebar Section ───── */
.wavy-imported-header {
  color: #6b7280 !important;
  font-size: var(--gf-text-caption) !important;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 0 !important;
}
.wavy-imported-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 12px !important;
  position: relative;
}
.wavy-imported-icon {
  flex-shrink: 0;
  font-size: var(--gf-text-body);
  color: #528bff;
}
.wavy-imported-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.wavy-imported-text .item-text {
  font-size: var(--gf-text-caption);
  color: #d1d5db;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wavy-imported-meta {
  font-size: var(--gf-text-caption);
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wavy-imported-remove {
  background: none;
  border: none;
  color: #6b7280;
  font-size: var(--gf-text-body);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: 0;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
  flex-shrink: 0;
}
.wavy-imported-item:hover .wavy-imported-remove {
  opacity: 1;
}
.wavy-imported-remove:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* ─── Shared Conversation Banner (in-modal) ─────────── */
.wavy-shared-banner {
  background: rgba(41, 112, 255, 0.08);
  border-bottom: 1px solid rgba(41, 112, 255, 0.2);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.wavy-shared-banner-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--gf-text-caption);
  color: #84adff;
}
.wavy-shared-imported-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
}
.wavy-shared-fork-btn {
  background: linear-gradient(135deg, #2966f4, #2966f4);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
  cursor: pointer;
  transition: opacity 160ms cubic-bezier(0.2, 0, 0, 1);
}
.wavy-shared-fork-btn:hover {
  opacity: 0.9;
}

/* ─── Share modal additions ─────────────────────── */
.sg-wavy-share-open {
  display: inline-block;
  margin-top: 12px;
  font-size: var(--gf-text-caption);
  color: var(--gf-blue);
  text-decoration: none;
}
.sg-wavy-share-open:hover {
  text-decoration: underline;
}
.sg-wavy-share-open[hidden] {
  display: none;
}
.sg-wavy-share-privacy {
  margin: 12px 0 0;
  font-size: var(--gf-text-caption);
  line-height: var(--gf-leading-caption);
  color: #667085;
}
.sg-wavy-stop-sharing {
  display: inline-flex;
  align-items: center;
  margin-top: 14px;
  padding: 8px 16px;
  border: 1px solid #fecdca;
  border-radius: 8px;
  background: #fef3f2;
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-medium);
  color: #b42318;
  cursor: pointer;
  transition: background 160ms var(--gf-ease, ease);
}
.sg-wavy-stop-sharing:hover {
  background: #fee4e2;
}
.sg-wavy-stop-sharing[hidden] {
  display: none;
}
.sg-wavy-header-btn.sg-wavy-share-btn.shared {
  background: #ecfdf3;
  border-color: #a6f4c5;
  color: #027a48;
}
.sg-wavy-header-btn.sg-wavy-share-btn.shared:hover {
  background: #d1fadf;
}
.wavy-folder-emoji {
  font-size: var(--gf-text-body);
  line-height: 1;
  flex-shrink: 0;
}

/* ─── Step Hiding Utility ───────────────────────── */
.homepage-hidden {
  display: none !important;
}

/* ─── Attachments in a sent user turn ─────────────────────────────
   What was sent is part of the message, not a separate system note: a thumbnail for
   images, a file row for everything else, then the text as the caption. */
.sg-wavy-message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sg-wavy-message-attachments:not(:last-child) {
  margin-bottom: 8px;
}

.sg-wavy-attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  border-radius: 10px;
  text-decoration: none;
}

.sg-wavy-attachment-image img {
  display: block;
  width: 168px;
  height: 168px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #ffffff33;
}

.sg-wavy-attachment-file {
  padding: 8px 10px;
  background: #ffffff1f;
  color: inherit;
  font-size: var(--gf-text-caption);
}

.sg-wavy-attachment-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sg-wavy-attachment-caption {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Wavy empty state, per the 2026-11 design ─────────────────────────────────────────────
   Four suggestion cards in two columns with a circular icon, and the greeting's second line
   in brand blue. Behaviour is untouched: same elements, same handlers. */
.ai_modal.fullwidth-mode .question .highlight {
  color: #2563eb;
}

.ai_modal.fullwidth-mode .sg-wavy-modal-overviews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.ai_modal.fullwidth-mode .sg-wavy-modal-overview-item {
  background: #ffffff;
  border: 1px solid #e8ecf3;
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.04);
}

.ai_modal.fullwidth-mode .sg-wavy-modal-overview-item h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  color: #101828;
}

.ai_modal.fullwidth-mode .sg-wavy-modal-overview-item h3 svg {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: 50%;
  background: #eef3ff;
  color: #2f5bf3;
  fill: #2f5bf3;
}

.ai_modal.fullwidth-mode .sg-wavy-modal-overview-item p {
  margin: 6px 0 0;
  font-size: var(--gf-text-caption);
  line-height: 1.5;
  color: #667085;
}

@media (max-width: 720px) {
  .ai_modal.fullwidth-mode .sg-wavy-modal-overviews {
    grid-template-columns: 1fr;
  }
}

/* ── Structured response blocks ──────────────────────────────────────────────
   Rendered by scripts/ai/wavy/response-renderer.js. Text blocks reuse the markdown styles above;
   these are the shapes markdown cannot express. */
.sg-wavy-block-list {
  margin: 8px 0;
  padding-left: 20px;
  font-size: var(--gf-text-body);
  line-height: 1.6;
  color: #101828;
}

.sg-wavy-block-list li { margin-bottom: 6px; }

.sg-wavy-block-keyvalue {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.sg-wavy-block-keyvalue > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eaecf0;
}

.sg-wavy-block-keyvalue dt {
  color: #667085;
  font-size: var(--gf-text-body);
}

.sg-wavy-block-keyvalue dd {
  margin: 0;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  text-align: right;
}

.sg-wavy-block-callout {
  margin: 12px 0;
  padding: 12px 14px;
  border-left: 3px solid #2f5bf3;
  border-radius: 10px;
  background: #f2f6ff;
  font-size: var(--gf-text-body);
  line-height: 1.55;
  color: #101828;
}

.sg-wavy-block-callout.is-success { border-left-color: #12a594; background: #effaf6; }
.sg-wavy-block-callout.is-warning { border-left-color: #f2a13b; background: #fff8ec; }
.sg-wavy-block-callout.is-danger { border-left-color: #e05a6b; background: #fdf2f3; }

.sg-wavy-block-callout-title {
  display: block;
  margin-bottom: 4px;
  font-weight: var(--gf-weight-semibold);
}

.sg-wavy-block-chart {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #eaecf0;
  border-radius: 14px;
  background: #fff;
}

.sg-wavy-block-chart-title {
  margin-bottom: 8px;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  color: #101828;
}

.sg-wavy-chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

.sg-wavy-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--gf-text-caption);
  color: #475467;
}

.sg-wavy-chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sg-wavy-chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.sg-wavy-block-image {
  margin: 12px 0;
}

.sg-wavy-block-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.sg-wavy-block-file {
  display: inline-flex;
  align-items: center;
  margin: 8px 0;
  padding: 8px 12px;
  border: 1px solid #eaecf0;
  border-radius: 10px;
  font-size: var(--gf-text-body);
  color: #2f5bf3;
  text-decoration: none;
}

.sg-wavy-block-file.is-static { color: #475467; }

.sg-wavy-block-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 8px 0 0;
  padding: 8px 14px;
  border: 1px solid #2f5bf3;
  border-radius: 999px;
  background: #fff;
  font-family: var(--gf-font);
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  color: #2f5bf3;
  cursor: pointer;
}

.sg-wavy-block-action[disabled] {
  border-color: #eaecf0;
  color: #98a2b3;
  cursor: not-allowed;
}

.sg-wavy-block-action-confirm {
  font-size: var(--gf-text-caption);
  font-weight: var(--gf-weight-regular);
  color: #667085;
}
