/* Flash messages as toasts: fixed overlay above header / drawer / bottom nav */
body .flash-messages-container {
  position: fixed !important; top: 16px; right: 16px; left: auto !important; bottom: auto !important;
  width: 380px; max-width: calc(100vw - 32px); margin: 0 !important; padding: 0 !important;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 10050 !important; pointer-events: none;
  background: transparent !important; border: 0 !important; box-shadow: none !important; height: 0; overflow: visible;
}

@media (max-width: 767px) {
  body .flash-messages-container {
    top: 12px;
    right: 12px;
    left: 12px !important;
    width: auto;
    max-width: none;
  }
}
body .flash-messages-container:empty { display: none; }

body .flash-messages-container .flash-message {
  position: relative; pointer-events: auto; margin: 0 !important; width: 100%; box-sizing: border-box;
  padding: 14px 40px 14px 18px !important; border-radius: 12px !important; border: 1px solid transparent;
  border-left: 5px solid #1b7a3d; background: #fff !important; color: #1b2559 !important; text-align: left;
  box-shadow: 0 12px 30px rgba(21, 45, 124, 0.22) !important; font-size: 14px; line-height: 1.4;
  display: block; overflow: hidden;
  animation: dlmToastIn .3s ease-out both;
}
body .flash-messages-container .flash-message.is-leaving { animation: dlmToastOut .3s ease-in both; }

body .flash-messages-container .flash-message__title { display: block; font-weight: 700; margin-bottom: 2px; color: inherit; }
body .flash-messages-container .flash-message__text { display: block; color: #4a5578; overflow-wrap: anywhere; }

body .flash-messages-container .flash-success { border-left-color: #1b7a3d; }
body .flash-messages-container .flash-success .flash-message__title { color: #1b7a3d; }
body .flash-messages-container .flash-error { border-left-color: #c62828; }
body .flash-messages-container .flash-error .flash-message__title { color: #c62828; }
body .flash-messages-container .flash-warning { border-left-color: #e08a00; }
body .flash-messages-container .flash-warning .flash-message__title { color: #9a6200; }
body .flash-messages-container .flash-info { border-left-color: #152d7c; }
body .flash-messages-container .flash-info .flash-message__title { color: #152d7c; }

body .flash-messages-container .flash-dismiss {
  position: absolute !important; top: 8px !important; right: 10px !important; left: auto !important; margin: 0 !important;
  width: 24px; height: 24px; padding: 0 !important; border: 0 !important; border-radius: 6px; background: transparent !important;
  color: #6b7694 !important; font-size: 20px; line-height: 24px; cursor: pointer; text-align: center;
}
body .flash-messages-container .flash-dismiss:hover { background: #eef3ff !important; color: #152d7c !important; }

/* Progress bar showing time left */
body .flash-messages-container .flash-message::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: .25;
  transform-origin: left; animation: dlmToastBar var(--dlm-toast-ms, 5000ms) linear forwards;
}
body .flash-messages-container .flash-success::after { color: #1b7a3d; }
body .flash-messages-container .flash-error::after { color: #c62828; }
body .flash-messages-container .flash-warning::after { color: #e08a00; }
body .flash-messages-container .flash-info::after { color: #152d7c; }
body .flash-messages-container .flash-message:hover::after { animation-play-state: paused; }

@keyframes dlmToastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes dlmToastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }
@keyframes dlmToastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Fix: container must size to its toasts (toasts were being squashed) */
body .flash-messages-container { height: auto !important; }
body .flash-messages-container .flash-message { flex: 0 0 auto; height: auto !important; min-height: 56px; }
body .flash-messages-container .flash-message__title { margin-bottom: 2px !important; line-height: 1.3; }
