.toast-container {
  position: fixed;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999999999;
  pointer-events: none;
  font-family: inherit;
}

.top-left {
  top: 20px;
  left: 20px;
  align-items: flex-start;
}
.top-right {
  top: 20px;
  right: 20px;
  align-items: flex-end;
}
.top-center {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
}
.bottom-left {
  bottom: 20px;
  left: 20px;
  align-items: flex-start;
}
.bottom-right {
  bottom: 20px;
  right: 20px;
  align-items: flex-end;
}
.bottom-center {
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
}

.toast {
  position: relative;
  min-width: 320px;
  max-width: 420px;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
  opacity: 0;
  transform: scale(0.96) translateY(20px);
  animation: toastIn 300ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast:hover {
  transform: scale(1.01) translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.toast-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
}

.toast-error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border: none;
}

.toast-info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
}

.toast-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border: none;
}

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

@keyframes toastOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
}

.toast-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  left: auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-weight: 300;
}

.toast-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.toast-close-btn:active {
  transform: scale(0.95);
}
/* ------------------------------------------ */
.st-fw-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: pointer;
  overflow: hidden;
  border: none;
  padding: 0;
}

.st-fw-icon {
  width: 24px;
  height: 24px;
}

.st-fw-overlay {
  position: fixed;
  inset: 0;
  /* Make the host page fully obscured when the floating widget is open */
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(2px);
  z-index: 9998;
  display: none;
}

.st-fw-iframe-wrapper {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 458px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 124px); /* 100px (button + gap) + 24px (top padding) */
  /* Prevent underlying page from showing through if the iframe has any transparency */
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  z-index: 9999;
  transform: scale(0.75) translateY(20px);
  opacity: 0;
  /* `visibility`, not only `opacity`, so a CLOSED widget is out of the page
     entirely rather than an invisible sheet lying on top of it. With opacity
     alone this stayed a full-viewport fixed layer at z-index 10000 on every
     phone-width page load (see the ≤768px rule below): `pointer-events: none`
     let a mouse through, but the layer still sat over the host page for
     anything that hit-tests without honouring it, and still cost a
     full-screen compositing layer on every load.
     Delayed by the fade duration on the way out so the transition still
     plays; instant on the way in (see `.st-fw-visible`). */
  visibility: hidden;
  transition: transform 0.2s ease, opacity 0.2s ease, visibility 0s linear 0.2s;
  pointer-events: none;
}

/* (The old "narrower than widget" 506px floating-panel rule was removed: at
   any width ≤768px the widget is now full-screen — see the rule below — so a
   narrower floating-card breakpoint no longer applies.) */

/* Mobile: the floating investment widget takes over the full screen.
   Keyed on .st-fw-iframe-wrapper directly (NOT only the JS-applied
   .st-portfolio-mobile class) so it's reliable on phones: the launcher's
   full-screen JS was only ever triggered by a window "resize" event, which
   never fires on a device that just loads the page and opens the widget —
   leaving it stuck as a small floating card. Driving it from the media query
   makes full-screen deterministic, independent of any JS timing. */
@media (max-width: 768px) {
  /* `.st-fw-visible` matters here: unscoped, a CLOSED widget was still being
     stretched to the whole viewport at z-index 10000 on every phone-width
     page. Full-screen is what the widget does when it is OPEN. */
  .st-fw-iframe-wrapper.st-fw-visible {
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    /* 100vh doesn't shrink for a collapsing mobile address bar; 100dvh does.
       Declared second so unsupported browsers just keep the vh value. */
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    z-index: 10000 !important;
    /* Stop the inner scroll from chaining out to the host page (and the
       Android/Samsung overscroll glow) once it reaches its end — this is what
       let the page behind peek through at the top/bottom of a scroll. */
    overscroll-behavior: none !important;
  }
  .st-fw-iframe-wrapper.st-fw-visible .st-fw-iframe {
    overscroll-behavior: none !important;
  }
}

/* Close button for portfolio widget on mobile */
.st-fw-close-button {
  position: absolute;
  top: 16px;
  right: 64px; /* Position next to logout button (avatar 32px + gap 16px + logout 32px = 80px, so 64px leaves space) */
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border: none;
  display: none; /* Hidden by default — only shown when the widget is open on mobile (.st-fw-visible rule below), where it's full-screen and covers the launcher button that would otherwise close it. */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10001;
  transition: background 0.2s ease, transform 0.2s ease;
  color: white;
  font-size: 20px;
  line-height: 1;
  font-weight: 300;
  padding: 0;
}

.st-fw-close-button:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.st-fw-close-button:active {
  transform: scale(0.95);
}

/* Show the close button whenever the widget is open on mobile — it's
   full-screen there (see the media query above), so the launcher button that
   normally toggles it closed is covered by the panel and this in-panel button
   is the only way out. Gated on .st-fw-visible (set by the launcher on every
   open) rather than the JS-timing-dependent .st-portfolio-mobile class. */
@media (max-width: 768px) {
  .st-fw-iframe-wrapper.st-fw-visible .st-fw-close-button {
    display: flex;
  }
}

.st-fw-iframe-wrapper.st-fw-visible {
  transform: scale(1) translateY(0);
  opacity: 1;
  visibility: visible;
  /* No delay opening — the panel must be hit-testable the moment it animates in. */
  transition: transform 0.2s ease, opacity 0.2s ease, visibility 0s linear 0s;
  pointer-events: auto;
}

.st-fw-iframe {
  width: 100%;
  height: 100%;
  border: none;
}
