.jm-notification-viewport {
  bottom: max(22px, env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
  max-width: min(350px, calc(100vw - 32px));
  pointer-events: none;
  position: fixed;
  right: 22px;
  width: 100%;
  z-index: 60000;
}

.jm-notification {
  --notice-accent: #1677ff;
  --notice-soft: #e9f3ff;
  --notice-surface: #f7fbff;
  --notice-duration: 6000ms;
  align-items: flex-start;
  background: linear-gradient(135deg, #fff 0%, var(--notice-surface) 100%);
  border: 1px solid color-mix(in srgb, var(--notice-accent) 22%, #dfe8f5);
  border-radius: 13px;
  box-shadow: 0 18px 46px rgba(17, 38, 84, .18);
  color: #0a1c3b;
  cursor: grab;
  display: grid;
  column-gap: 14px;
  grid-template-columns: 40px minmax(0, 1fr) 26px;
  opacity: 0;
  overflow: hidden;
  padding: 12px 11px 14px;
  pointer-events: auto;
  position: relative;
  touch-action: pan-y;
  transform: translate3d(calc(100% + 32px), 0, 0);
  transition: opacity .28s ease, transform .42s cubic-bezier(.22, 1, .36, 1), box-shadow .2s ease;
  will-change: opacity, transform;
}

.jm-notification::after {
  background: var(--notice-accent);
  bottom: 0;
  content: "";
  height: 4px;
  left: 0;
  position: absolute;
  right: 0;
  transform: scaleX(1);
  transform-origin: left center;
}

.jm-notification.has-timer::after { animation: jmNoticeProgress var(--notice-duration) linear forwards; }
.jm-notification.is-paused::after { animation-play-state: paused; }
.jm-notification.is-visible { opacity: 1; transform: translate3d(0, 0, 0); }
.jm-notification.is-leaving { opacity: 0; transform: translate3d(calc(100% + 38px), 0, 0); }
.jm-notification.is-dragging { cursor: grabbing; transition: none; user-select: none; }
.jm-notification.is-clickable { cursor: pointer; }

.jm-notification:hover,
.jm-notification:focus-within { box-shadow: 0 24px 60px rgba(17, 38, 84, .23); }

.jm-notification[data-kind="success"] { --notice-accent: #18ad69; --notice-soft: #daf7e8; --notice-surface: #f3fff8; }
.jm-notification[data-kind="warning"],
.jm-notification[data-kind="medium"] { --notice-accent: #f59e0b; --notice-soft: #fff0cf; --notice-surface: #fffaf0; }
.jm-notification[data-kind="error"],
.jm-notification[data-kind="danger"],
.jm-notification[data-kind="critical"],
.jm-notification[data-kind="high"] { --notice-accent: #ef4444; --notice-soft: #ffe0e1; --notice-surface: #fff6f6; }
.jm-notification[data-kind="security"],
.jm-notification[data-kind="admin"] { --notice-accent: #7c3aed; --notice-soft: #eadfff; --notice-surface: #faf7ff; }
.jm-notification[data-kind="info"],
.jm-notification[data-kind="low"] { --notice-accent: #1677ff; --notice-soft: #dfeeff; --notice-surface: #f5f9ff; }

.jm-notification-icon {
  align-self: center;
  align-items: center;
  background: var(--notice-accent);
  border-radius: 50%;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--notice-accent) 28%, transparent);
  color: #fff;
  display: inline-flex;
  font-size: 1rem;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.jm-notification-copy { min-width: 0; }
.jm-notification-title { font-size: .86rem; font-weight: 850; line-height: 1.2; margin: 1px 0 3px; }
.jm-notification-message { color: #62718c; font-size: .75rem; line-height: 1.35; overflow-wrap: anywhere; }
.jm-notification-meta { color: #8591a5; font-size: .65rem; font-weight: 680; margin-top: 4px; }

.jm-notification-close {
  align-self: start;
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: #76859b;
  cursor: pointer;
  display: inline-flex;
  height: 26px;
  justify-content: center;
  padding: 0;
  transition: background .16s ease, color .16s ease, transform .16s ease;
  width: 26px;
}

.jm-notification-close:hover { background: rgba(17, 38, 84, .07); color: #132646; transform: rotate(5deg); }
body[data-theme="dark"] .jm-notification,
[data-bs-theme="dark"] .jm-notification {
  background: linear-gradient(135deg, rgba(12, 31, 57, .99), rgba(14, 38, 67, .99));
  border-color: color-mix(in srgb, var(--notice-accent) 34%, rgba(166, 198, 239, .2));
  box-shadow: 0 24px 62px rgba(0, 0, 0, .44);
  color: #eef6ff;
}

body[data-theme="dark"] .jm-notification-message,
[data-bs-theme="dark"] .jm-notification-message { color: #b8c8df; }
body[data-theme="dark"] .jm-notification-meta,
[data-bs-theme="dark"] .jm-notification-meta { color: #91a4bf; }
body[data-theme="dark"] .jm-notification-close:hover,
[data-bs-theme="dark"] .jm-notification-close:hover { background: rgba(255, 255, 255, .08); color: #fff; }

@keyframes jmNoticeProgress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (max-width: 640px) {
  .jm-notification-viewport { bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; max-width: none; right: 12px; width: auto; }
  .jm-notification { column-gap: 12px; grid-template-columns: 38px minmax(0, 1fr) 24px; padding: 11px 10px 14px; }
  .jm-notification-icon { height: 38px; width: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .jm-notification { transition-duration: .01ms; }
  .jm-notification.has-timer::after { animation-timing-function: steps(1, end); }
}
