/* Product toasts — compact cards at the bottom-right, out of the way of page actions. */

.br-app .br-flashes {
  position: fixed;
  top: auto;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(22.5rem, calc(100vw - 2rem));
  max-height: min(40vh, calc(100dvh - 6rem));
  overflow: auto;
  scrollbar-width: none;
  margin: 0;
  pointer-events: none;
}

.br-app .br-flashes::-webkit-scrollbar {
  display: none;
}

.br-app .br-flash {
  position: relative;
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 0.75rem 0.8rem 0.85rem;
  overflow: hidden;
  border: 1px solid var(--app-border-strong);
  border-radius: 10px;
  background: color-mix(in srgb, var(--app-elevated, #202020) 92%, #000);
  color: var(--app-text-body);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  animation: br-toast-in 180ms var(--app-spring, ease-out) both;
}

.br-app .br-flash__icon {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
}

.br-app .br-flash__body { min-width: 0; }

.br-app .br-flash__title {
  margin: 0;
  color: var(--app-text);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
}

.br-app .br-flash__message {
  margin: 0.15rem 0 0;
  color: var(--app-text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.br-app .br-flash__close {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  cursor: pointer;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--app-text-faint);
}

.br-app .br-flash__close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--app-text);
}

.br-app .br-flash__close:focus-visible {
  outline: 2px solid var(--app-text);
  outline-offset: 2px;
}

.br-app .br-flash--notice { border-color: color-mix(in srgb, var(--app-success) 34%, var(--app-border)); }
.br-app .br-flash--alert { border-color: color-mix(in srgb, var(--app-danger) 40%, var(--app-border)); }
.br-app .br-flash--warning { border-color: color-mix(in srgb, var(--app-warning) 40%, var(--app-border)); }
.br-app .br-flash--info { border-color: var(--app-border-strong); }
.br-app .br-flash--notice .br-flash__icon { color: var(--app-success-light); }
.br-app .br-flash--alert .br-flash__icon { color: var(--app-danger); }
.br-app .br-flash--warning .br-flash__icon { color: var(--app-warning); }

.br-app .br-flash__progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: color-mix(in srgb, var(--app-text) 22%, transparent);
  transform-origin: left center;
  animation: br-toast-progress var(--toast-duration, 6s) linear forwards;
}

.br-app .br-flash--notice .br-flash__progress { background: color-mix(in srgb, var(--app-success-light) 80%, transparent); }
.br-app .br-flash.is-paused .br-flash__progress { animation-play-state: paused; }
.br-app .br-flash.is-leaving { animation: br-toast-out 160ms ease-in forwards; }

.br-flashes {
  display: grid;
  width: 100%;
  gap: 0.75rem;
  margin: 0 0 var(--br-space-md);
}

.br-flash {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem;
  overflow: hidden;
  border: 1px solid var(--br-border-default);
  border-radius: var(--br-radius-lg);
  background: color-mix(in srgb, var(--br-surface-2) 94%, transparent);
  color: var(--br-text-body);
}

.br-flash__title {
  margin: 0;
  color: var(--br-text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
}

.br-flash__message {
  margin: 0.25rem 0 0;
  color: var(--br-text-secondary);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.br-flash__close {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--br-text-muted);
}

.br-flash.is-leaving {
  animation: br-flash-leave 180ms ease-in forwards;
}

.br-flash--notice {
  background: var(--br-success-soft);
  border-color: color-mix(in srgb, var(--br-success) 25%, transparent);
  color: var(--br-success-bright);
}

.br-flash--alert {
  background: color-mix(in srgb, var(--br-danger) 12%, transparent);
  border-color: color-mix(in srgb, var(--br-danger) 40%, transparent);
  color: #fecdd3;
}

@keyframes br-flash-leave {
  to { opacity: 0; transform: translateY(-6px); }
}

.br-app .swal2-container {
  z-index: 11000;
}

.br-app .swal2-container.swal2-backdrop-show {
  background: rgba(0, 0, 0, 0.62);
}

.br-app .br-swal {
  width: min(28rem, calc(100vw - 1.5rem));
  padding: 1.15rem;
  border: 1px solid var(--app-border-strong);
  border-radius: 14px;
  background: var(--app-card) !important;
  color: var(--app-text-body);
  box-shadow: none;
}

.br-app .br-swal__title {
  color: var(--app-text);
  font-family: var(--br-font-sans);
  font-size: 1.05rem;
}

.br-app .br-swal__copy {
  color: var(--app-text-muted);
  font-size: 0.85rem;
}

.br-app .br-swal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.br-app .br-swal .swal2-icon {
  margin: 0.2rem auto 0.7rem;
  border-width: 2px;
}

.br-swal-enter {
  animation: br-app-toast-in 160ms var(--app-spring, ease-out) both;
}

.br-swal-exit {
  animation: br-app-toast-out 140ms ease-in both;
}

.br-app .br-swal-toast-container {
  background: transparent !important;
}

.br-app .br-swal--toast {
  display: flex;
  align-items: center;
  width: auto;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
}

.br-app .br-swal__toast-title {
  margin: 0;
  color: var(--app-text);
  font-size: 0.82rem;
}

.br-app .swal2-container.br-swal-toast-container {
  inset: auto 0 0 auto;
  height: auto;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  pointer-events: none;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  width: min(24rem, 100vw);
}

.br-app .swal2-popup.br-swal--toast {
  /* SweetAlert writes display:grid inline; its modal row positions must not size a toast. */
  display: flex !important;
  align-items: center;
  min-height: 0;
  height: auto;
  pointer-events: auto;
  width: 100%;
  gap: 0.7rem;
  padding: 0.8rem 0.9rem 1rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--app-success) 34%, var(--app-border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--app-elevated, #202020) 92%, #000);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
}

.br-app .br-swal--toast .swal2-icon {
  flex: 0 0 auto;
  width: 1.7rem !important;
  height: 1.7rem !important;
  min-width: 1.7rem;
  margin: 0 !important;
  border-width: 0;
}

.br-app .br-swal--toast .swal2-icon .swal2-icon-content { font-size: 0.85rem; }
.br-app .br-swal--toast .swal2-success-ring { display: none; }
.br-app .br-swal--toast .swal2-success [class^="swal2-success-line"] { background-color: var(--app-success-light); }

.br-app .br-swal--toast .br-swal__toast-title {
  margin: 0;
  color: var(--app-text);
  font-family: var(--br-font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.br-app .br-swal__toast-progress {
  height: 2px !important;
  background: color-mix(in srgb, var(--app-success-light) 80%, transparent);
}

.br-swal-toast-enter { animation: br-toast-in 180ms var(--app-spring, ease-out) both; }
.br-swal-toast-exit { animation: br-toast-out 160ms ease-in both; }

@keyframes br-toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes br-toast-out {
  to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

@keyframes br-toast-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (max-width: 599px) {
  .br-app .br-flashes {
    right: 0.75rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    width: calc(100vw - 1.5rem);
  }
  .br-app .br-flash { padding: 0.75rem 0.7rem 0.75rem 0.8rem; }
  .br-app .swal2-container.br-swal-toast-container {
    padding: 0.75rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .br-app .br-flash,
  .br-app .br-flash.is-leaving,
  .br-app .br-flash__progress,
  .br-flash.is-leaving,
  .br-app .br-swal-toast-enter,
  .br-app .br-swal-toast-exit { animation: none; }
}

/* Auth portal feedback stays in this established asset so Propshaft's app bundle
   never depends on a newly introduced standalone stylesheet. */

.br-auth-portal-card .br-flashes {
  gap: 0.5rem;
  margin-top: 1rem;
}

.br-auth-portal-card .br-flash {
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.7rem;
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 0.8rem;
  background: rgba(8, 9, 10, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.br-auth-portal-card .br-flash__icon {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0;
  background: transparent;
}

.br-auth-portal-card .br-flash__body {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.4rem;
}

.br-auth-portal-card .br-flash__title,
.br-auth-portal-card .br-flash__message {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
}

.br-auth-portal-card .br-flash__title {
  font-weight: 650;
}

.br-auth-portal-card .br-flash__message {
  color: rgba(161, 161, 170, 0.92);
}

.br-auth-portal-card .br-flash__close {
  width: 1.5rem;
  height: 1.5rem;
}

.br-auth-portal-card .br-flash__progress {
  height: 1px;
}
