.erp-alert {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    overflow: hidden;
    transition: opacity 300ms ease, transform 300ms ease, max-height 300ms ease, margin 300ms ease, padding 300ms ease;
}

.erp-alert[data-auto-dismiss]:not([data-auto-dismiss="0"])::after,
.erp-live-toast::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #1457c7;
    content: "";
    transform-origin: left;
    animation: erpNotificationCountdown var(--erp-alert-duration) linear forwards;
}

.erp-alert-close,
.erp-live-toast-close {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    padding: 0;
    place-items: center;
    color: currentColor;
    background: transparent;
    border: 0;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    opacity: .68;
    cursor: pointer;
}

.erp-alert-close:hover,
.erp-live-toast-close:hover { background: #e8eef8; opacity: 1; }

.erp-alert.is-hiding,
.erp-live-toast.is-hiding {
    max-height: 0 !important;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
    opacity: 0;
    transform: translateX(18px);
    pointer-events: none;
}

.erp-notification-stack {
    position: fixed;
    top: var(--erp-notification-top, 86px);
    right: 18px;
    z-index: 1085;
    display: grid;
    width: min(390px, calc(100vw - 28px));
    gap: 10px;
    pointer-events: none;
}

.erp-alert[data-notification-position="navbar-bottom"]:not(.erp-notification-stack .erp-alert) {
    position: fixed;
    top: var(--erp-notification-top, 86px);
    right: 18px;
    z-index: 1085;
    width: min(390px, calc(100vw - 28px));
    margin: 0;
    box-shadow: 0 16px 42px rgba(15, 35, 70, .22);
}

.erp-notification-stack .erp-alert {
    width: 100%;
    max-height: 240px;
    margin: 0;
    box-shadow: 0 16px 42px rgba(15, 35, 70, .22);
    pointer-events: auto;
}

.erp-live-toast {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto 28px;
    gap: 10px;
    align-items: center;
    max-height: 220px;
    padding: 14px;
    overflow: hidden;
    color: #17243a;
    background: #fff;
    border: 1px solid #cbd8eb;
    border-left: 4px solid #1457c7;
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 35, 70, .24);
    animation: erpNotificationIn 260ms ease both;
    transition: opacity 300ms ease, transform 300ms ease, max-height 300ms ease, padding 300ms ease;
    pointer-events: auto;
}

.erp-live-toast-icon,
.erp-notification-type {
    display: grid;
    place-items: center;
    color: #fff;
    background: #1457c7;
    border-radius: 8px;
}

.erp-live-toast-icon { width: 38px; height: 38px; }
.erp-live-toast-copy { min-width: 0; }
.erp-live-toast-copy strong,
.erp-live-toast-copy small,
.erp-live-toast-copy span { display: block; }
.erp-live-toast-copy strong { font-size: .9rem; }
.erp-live-toast-copy small { margin-top: 3px; color: #526177; line-height: 1.35; }
.erp-live-toast-copy span { margin-top: 5px; color: #76849a; font-size: .7rem; }
.erp-live-toast-view { color: #1457c7; font-size: .78rem; font-weight: 700; text-decoration: none; }

.erp-notification-button.has-new { animation: erpBellAttention 700ms ease 2; }
.erp-notification-button.has-new::after {
    position: absolute;
    inset: -5px;
    border: 2px solid #82b4ff;
    border-radius: 50%;
    content: "";
    animation: erpBellRing 900ms ease-out 2;
}

.erp-notification-badge { transition: transform 180ms ease; }
.erp-notification-button.has-new .erp-notification-badge { transform: scale(1.16); }

.erp-notification-menu {
    width: min(430px, calc(100vw - 24px));
    padding: 0;
    overflow: hidden;
    border: 1px solid #d9e2ef;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(15, 35, 70, .24);
}

.erp-notification-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: #fff;
    background: #164fa7;
    border-bottom: 1px solid #dbe4f1;
}

.erp-notification-heading strong,
.erp-notification-heading small { display: block; }
.erp-notification-heading small { margin-top: 2px; color: #d9e8ff; font-size: .68rem; }
.erp-notification-actions { display: flex; gap: 4px; }
.erp-notification-heading .erp-notification-actions button {
    padding: 5px 7px;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 6px;
    font-size: .7rem;
    line-height: 1.2;
}
.erp-notification-heading .erp-notification-actions button:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
.erp-notification-heading .erp-notification-actions button:disabled { opacity: .45; }

.erp-notification-list { max-height: min(430px, calc(100vh - 210px)); overflow-y: auto; }
.erp-notification-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 76px;
    padding: 10px 12px;
    color: #263348;
    background: #fff;
    border-bottom: 1px solid #e8edf4;
}
.erp-notification-item:hover { background: #f7faff; }
.erp-notification-item.unread { background: #eaf3ff; box-shadow: inset 3px 0 #1764d7; }
.erp-notification-type { width: 34px; height: 34px; font-size: .82rem; }
.erp-notification-copy { min-width: 0; }
.erp-notification-copy strong,
.erp-notification-copy small,
.erp-notification-meta { display: block; }
.erp-notification-copy strong { color: #17243a; font-size: .82rem; }
.erp-notification-copy small { margin-top: 3px; overflow: hidden; color: #5d6b80; font-size: .75rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.erp-notification-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; color: #8591a3; font-size: .66rem; }
.erp-notification-state { padding: 1px 6px; color: #475569; background: #eef2f7; border-radius: 999px; font-weight: 800; }
.erp-notification-state.unread { color: #1457c7; background: #dbeafe; }
.erp-notification-item .btn { min-width: 48px; padding: 4px 7px; font-size: .69rem; }
.erp-notification-empty { padding: 24px 16px; text-align: center; color: #748197; }
.erp-notification-history-link { display: block; padding: 10px 14px; color: #1457c7; background: #f8fafc; font-size: .78rem; font-weight: 700; text-align: center; text-decoration: none; }
.erp-notification-history-link:hover { background: #edf4ff; }
.erp-notification-history-unread > td { background: #eef5ff; }

@keyframes erpNotificationCountdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes erpNotificationIn { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: translateX(0); } }
@keyframes erpBellAttention { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(12deg); } 75% { transform: rotate(-12deg); } }
@keyframes erpBellRing { from { opacity: .9; transform: scale(.8); } to { opacity: 0; transform: scale(1.35); } }

@media (max-width: 640px) {
    .erp-notification-stack { right: 14px; width: calc(100vw - 28px); }
    .erp-live-toast { grid-template-columns: 34px minmax(0, 1fr) 28px; }
    .erp-live-toast-view { grid-column: 2; justify-self: start; }
    .erp-live-toast-close { grid-column: 3; grid-row: 1; }
    .erp-notification-menu { position: fixed !important; top: var(--erp-notification-top, 76px) !important; right: 12px !important; left: 12px !important; width: auto; transform: none !important; }
    .erp-notification-heading { align-items: flex-start; }
    .erp-notification-actions { flex-direction: column; }
    .erp-notification-list { max-height: calc(100vh - 240px); }
    .erp-notification-copy small { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
    .erp-alert,
    .erp-alert::after,
    .erp-live-toast,
    .erp-live-toast::after,
    .erp-notification-button { animation: none !important; transition-duration: 1ms !important; }
}

html[data-erp-appearance="dark"] .erp-live-toast,
html[data-erp-appearance="dark"] .erp-notification-menu,
html[data-erp-appearance="dark"] .erp-notification-item {
    color: var(--erp-ink) !important;
    background: var(--erp-surface) !important;
    border-color: var(--erp-line) !important;
}

html[data-erp-appearance="dark"] .erp-live-toast {
    border-left-color: var(--erp-primary) !important;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .34) !important;
}

html[data-erp-appearance="dark"] .erp-notification-item:hover,
html[data-erp-appearance="dark"] .erp-notification-item.unread,
html[data-erp-appearance="dark"] .erp-notification-history-link,
html[data-erp-appearance="dark"] .erp-notification-history-unread > td,
html[data-erp-appearance="dark"] .erp-notification-state {
    color: var(--erp-ink) !important;
    background: var(--erp-surface-soft) !important;
    border-color: var(--erp-line) !important;
}

html[data-erp-appearance="dark"] .erp-notification-copy strong,
html[data-erp-appearance="dark"] .erp-live-toast-copy strong {
    color: var(--erp-ink) !important;
}

html[data-erp-appearance="dark"] .erp-notification-copy small,
html[data-erp-appearance="dark"] .erp-notification-meta,
html[data-erp-appearance="dark"] .erp-live-toast-copy small,
html[data-erp-appearance="dark"] .erp-live-toast-copy span,
html[data-erp-appearance="dark"] .erp-notification-empty {
    color: var(--erp-muted) !important;
}

html[data-erp-appearance="dark"] .erp-notification-heading,
html[data-erp-appearance="dark"] .erp-live-toast-icon,
html[data-erp-appearance="dark"] .erp-notification-type {
    background: #1d4ed8 !important;
}

html[data-erp-appearance="dark"] .erp-alert-close:hover,
html[data-erp-appearance="dark"] .erp-live-toast-close:hover {
    background: #2b313a !important;
}
