:root {
    --popover: #ffffff;
    --popover-foreground: #000000;
    --border: #e5e5e5;
    --radius: 0.5rem;
  }

  body[data-theme="dark"] {
    --popover: #262626;
    --popover-foreground: #ffffff;
    --border: #ffffff1a;
  }

  .toasts {
    position: fixed;
    z-index: 9999;
    right: 20px;
    top: 20px;
    width: 356px;
    pointer-events: none;
    max-height: calc(100vh - 40px);
    overflow: visible;
  }

  .custom-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--popover);
    color: var(--popover-foreground);
    border-radius: calc(var(--radius) - 2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    padding: 16px;
    width: 356px;
    border: 1px solid var(--border);
    transform: translateX(400px);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    will-change: transform, opacity, max-height;
    transition: transform 0.35s cubic-bezier(0.21, 1.02, 0.73, 1),
      opacity 0.35s cubic-bezier(0.21, 1.02, 0.73, 1),
      max-height 0.35s cubic-bezier(0.21, 1.02, 0.73, 1);
    font-size: 14px;
    line-height: 1.5;
    position: absolute;
    top: 0;
    right: 0;
  }

  /* Mobile push notification style stacking - offset each toast */
  .custom-toast[data-stack-index="0"] {
    transform: translateX(0);
    opacity: 1;
    z-index: 3;
    top: 0;
  }

  .custom-toast[data-stack-index="1"] {
    transform: translate(8px, 8px);
    opacity: 1;
    z-index: 2;
    top: 0;
  }

  .custom-toast[data-stack-index="2"] {
    transform: translate(16px, 16px);
    opacity: 1;
    z-index: 1;
    top: 0;
  }

  /* Hide toasts beyond the 3rd visible one */
  .custom-toast[data-stack-index]:not([data-stack-index="0"]):not([data-stack-index="1"]):not([data-stack-index="2"]) {
    display: none;
  }

  body[data-theme="dark"] .custom-toast {
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
  }

  .custom-toast[data-state="open"] {
    max-height: 200px;
    will-change: auto;
  }

  .custom-toast[data-state="open"][data-stack-index="0"] {
    transform: translateX(0);
    opacity: 1;
  }

  .custom-toast[data-state="open"][data-stack-index="1"] {
    transform: translate(8px, 8px);
    opacity: 1;
  }

  .custom-toast[data-state="open"][data-stack-index="2"] {
    transform: translate(16px, 16px);
    opacity: 1;
  }

  .custom-toast[data-state="closed"] {
    transform: translateX(400px);
    opacity: 0;
    max-height: 0;
    transition: transform 0.35s cubic-bezier(0.21, 1.02, 0.73, 1),
      opacity 0.35s cubic-bezier(0.21, 1.02, 0.73, 1),
      max-height 0.35s cubic-bezier(0.21, 1.02, 0.73, 1);
  }

  .custom-toast .icon {
    font-size: 16px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .custom-toast .body {
    flex: 1;
    font-weight: 400;
    color: var(--popover-foreground);
  }

  /* Toast counter badge for hidden toasts */
  .toast-counter {
    position: absolute;
    top: -8px;
    right: -8px;
    background: hsl(222.2 47.4% 11.2%);
    color: white;
    border-radius: 10px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    border: 2px solid var(--popover);
  }

  body[data-theme="dark"] .toast-counter {
    background: hsl(210 40% 98%);
    color: hsl(222.2 47.4% 11.2%);
  }

  @media (max-width: 480px) {
    .toasts {
      width: 300px;
      right: 10px;
    }
    .custom-toast {
      width: 300px;
    }
  }