/* Shared toast component for public, user and admin layouts. */
#appNotice.app-notice-stack {
  position: fixed;
  top: calc(84px + env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  left: auto;
  bottom: auto;
  z-index: 2147483600;
  display: grid;
  width: min(390px, calc(100vw - 40px));
  gap: 12px;
  pointer-events: none;
}

#appNotice.app-notice-stack:empty {
  display: none;
}

#appNotice.app-notice-stack .app-toast {
  --notice-accent: #2563eb;
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  margin: 0;
  overflow: hidden;
  padding: 13px 12px 13px 14px;
  border: 1px solid color-mix(in srgb, var(--notice-accent) 24%, #d9e5f5);
  border-radius: 16px;
  color: #143160;
  background: #fff;
  box-shadow: 0 18px 46px rgba(15, 35, 67, .18);
  opacity: 0;
  transform: translateX(24px) scale(.98);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: auto;
}

#appNotice.app-notice-stack .app-toast::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--notice-accent);
}

#appNotice.app-notice-stack .app-toast.is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}

#appNotice.app-notice-stack .app-toast.is-leaving {
  opacity: 0;
  transform: translateX(20px) scale(.98);
}

#appNotice.app-notice-stack .app-toast.success { --notice-accent: #168253; }
#appNotice.app-notice-stack .app-toast.error { --notice-accent: #dc2626; }
#appNotice.app-notice-stack .app-toast.warning { --notice-accent: #d97706; }
#appNotice.app-notice-stack .app-toast.info { --notice-accent: #2563eb; }

#appNotice.app-notice-stack .notice-icon {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--notice-accent);
  background: color-mix(in srgb, var(--notice-accent) 12%, #fff);
  font-size: 18px;
  font-weight: 700;
}

#appNotice.app-notice-stack .notice-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 3px;
  min-width: 0;
  line-height: 1.35;
}

#appNotice.app-notice-stack .notice-copy small {
  color: var(--notice-accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

#appNotice.app-notice-stack .notice-copy b {
  color: #0f2343;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

#appNotice.app-notice-stack .notice-close {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: #637793;
  background: transparent;
  font: inherit;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

#appNotice.app-notice-stack .notice-close:hover {
  color: var(--notice-accent);
  background: color-mix(in srgb, var(--notice-accent) 10%, #fff);
}

#appNotice.app-notice-stack .notice-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--notice-accent);
  transform-origin: left center;
  animation: app-notice-progress var(--notice-duration, 3600ms) linear forwards;
}

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

@media (max-width: 640px) {
  #appNotice.app-notice-stack {
    top: calc(env(safe-area-inset-top) + var(--cloud-topbar-h, 60px) + 10px);
    right: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100dvh - env(safe-area-inset-top) - var(--cloud-topbar-h, 60px) - 20px);
    overflow-y: auto;
  }

  #appNotice.app-notice-stack .app-toast {
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    min-height: 64px;
    gap: 10px;
    padding: 11px 10px 11px 12px;
    border-radius: 14px;
  }

  #appNotice.app-notice-stack .notice-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #appNotice.app-notice-stack .app-toast {
    transition: none;
  }

  #appNotice.app-notice-stack .notice-progress {
    animation: none;
  }
}

/*
 * Final compatibility layer.
 * Older page styles still target `.notice` with a two-column grid. The shared
 * renderer always outputs icon, copy and close controls, so keep those three
 * items on one row across public, user and admin layouts.
 */
body.cloud-ui-2026 #appNotice.app-notice-stack {
  top: max(16px, env(safe-area-inset-top)) !important;
  right: max(16px, env(safe-area-inset-right)) !important;
  left: auto !important;
  bottom: auto !important;
  display: grid !important;
  width: min(380px, calc(100vw - 32px)) !important;
  max-height: calc(100dvh - 32px) !important;
  gap: 10px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body.cloud-ui-2026.app-page #appNotice.app-notice-stack,
body.cloud-ui-2026.admin-page #appNotice.app-notice-stack {
  top: calc(env(safe-area-inset-top) + var(--cloud-topbar-h, 60px) + 12px) !important;
  max-height: calc(100dvh - env(safe-area-inset-top) - var(--cloud-topbar-h, 60px) - 24px) !important;
}

body.cloud-ui-2026 #appNotice.app-notice-stack > .app-toast.notice {
  display: grid !important;
  grid-template-columns: 38px minmax(0, 1fr) 30px !important;
  grid-template-rows: auto !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  min-height: 64px !important;
  padding: 11px 10px 11px 12px !important;
  border-radius: 14px !important;
}

body.cloud-ui-2026 #appNotice.app-notice-stack > .app-toast.notice > .notice-icon {
  grid-column: 1 !important;
  grid-row: 1 !important;
  width: 38px !important;
  height: 38px !important;
  border-radius: 12px !important;
  font-size: 16px !important;
}

body.cloud-ui-2026 #appNotice.app-notice-stack > .app-toast.notice > .notice-copy {
  grid-column: 2 !important;
  grid-row: 1 !important;
  min-width: 0 !important;
}

body.cloud-ui-2026 #appNotice.app-notice-stack > .app-toast.notice > .notice-copy small {
  font-size: 10px !important;
  line-height: 1.25 !important;
}

body.cloud-ui-2026 #appNotice.app-notice-stack > .app-toast.notice > .notice-copy b {
  font-size: 12px !important;
  line-height: 1.4 !important;
}

body.cloud-ui-2026 #appNotice.app-notice-stack > .app-toast.notice > .notice-close {
  position: relative !important;
  grid-column: 3 !important;
  grid-row: 1 !important;
  align-self: center !important;
  justify-self: center !important;
  width: 30px !important;
  min-width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.cloud-ui-2026 #appNotice.app-notice-stack > .app-toast.notice > .notice-progress {
  grid-column: 1 / -1 !important;
}

@media (max-width: 520px) {
  body.cloud-ui-2026 #appNotice.app-notice-stack,
  body.cloud-ui-2026.app-page #appNotice.app-notice-stack,
  body.cloud-ui-2026.admin-page #appNotice.app-notice-stack {
    top: calc(env(safe-area-inset-top) + var(--cloud-topbar-h, 60px) + 8px) !important;
    right: 10px !important;
    left: 10px !important;
    width: auto !important;
    max-height: calc(100dvh - env(safe-area-inset-top) - var(--cloud-topbar-h, 60px) - 18px) !important;
  }

  body.cloud-ui-2026 #appNotice.app-notice-stack > .app-toast.notice {
    grid-template-columns: 32px minmax(0, 1fr) 28px !important;
    min-height: 56px !important;
    gap: 8px !important;
    padding: 9px 8px 9px 10px !important;
    border-radius: 12px !important;
  }

  body.cloud-ui-2026 #appNotice.app-notice-stack > .app-toast.notice > .notice-icon {
    width: 32px !important;
    height: 32px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
  }

  body.cloud-ui-2026 #appNotice.app-notice-stack > .app-toast.notice > .notice-close {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
  }

  body.cloud-ui-2026 #appNotice.app-notice-stack > .app-toast.notice > .notice-copy small {
    font-size: 9px !important;
  }

  body.cloud-ui-2026 #appNotice.app-notice-stack > .app-toast.notice > .notice-copy b {
    font-size: 11px !important;
  }
}
