.system-notification-region {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 20050;
    width: min(430px, calc(100vw - 28px));
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.system-notification {
    --notification-accent: #2563eb;
    --notification-soft: #eff6ff;
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 28px;
    gap: 11px;
    padding: 14px 12px 13px 14px;
    background: #fff;
    color: #273142;
    border: 1px solid rgba(15, 23, 42, .1);
    border-left: 4px solid var(--notification-accent);
    border-radius: 12px;
    box-shadow: 0 14px 38px rgba(15, 23, 42, .2), 0 3px 8px rgba(15, 23, 42, .08);
    pointer-events: auto;
    animation: system-notification-in .24s ease-out both;
}

.system-notification.is-leaving {
    animation: system-notification-out .2s ease-in both;
}

.system-notification--success { --notification-accent: #16865a; --notification-soft: #eaf8f1; }
.system-notification--error { --notification-accent: #d13c47; --notification-soft: #fff0f1; }
.system-notification--warning { --notification-accent: #b56b00; --notification-soft: #fff7e6; }
.system-notification--info { --notification-accent: #2563eb; --notification-soft: #eff6ff; }

.system-notification__icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--notification-accent);
    background: var(--notification-soft);
    font: 700 18px/1 Arial, sans-serif;
}

.system-notification__content { min-width: 0; }

.system-notification__heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 5px;
}

.system-notification__title {
    margin: 0;
    color: #172033;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
}

.system-notification__badge {
    display: inline-block;
    padding: 2px 7px;
    color: var(--notification-accent);
    background: var(--notification-soft);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .045em;
    line-height: 1.5;
    text-transform: uppercase;
}

.system-notification__message {
    position: relative;
    max-height: 4.45em;
    overflow: hidden;
    color: #4b5565;
    font-size: 13px;
    line-height: 1.48;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.system-notification__message.is-expanded {
    max-height: min(48vh, 430px);
    overflow: auto;
    padding-right: 5px;
}

.system-notification__actions {
    margin-top: 7px;
}

.system-notification__expand {
    padding: 0;
    color: var(--notification-accent);
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.system-notification__expand:hover,
.system-notification__expand:focus { text-decoration: underline; outline: 0; }

.system-notification__close {
    width: 28px;
    height: 28px;
    padding: 0;
    color: #667085;
    background: transparent;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.system-notification__close:hover,
.system-notification__close:focus { color: #111827; background: rgba(15, 23, 42, .06); outline: 0; }

.system-notification__progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(15, 23, 42, .05);
}

.system-notification__progress::after {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: var(--notification-accent);
    transform-origin: left center;
    animation: system-notification-progress var(--notification-duration, 6000ms) linear forwards;
}

.system-notification.is-paused .system-notification__progress::after { animation-play-state: paused; }
.system-notification.is-persistent .system-notification__progress { display: none; }

.dark-mode .system-notification,
body.dark-mode .system-notification {
    background: #202938;
    color: #f8fafc;
    border-color: rgba(255, 255, 255, .1);
    box-shadow: 0 14px 38px rgba(0, 0, 0, .42);
}

.dark-mode .system-notification__title,
body.dark-mode .system-notification__title { color: #f8fafc; }
.dark-mode .system-notification__message,
body.dark-mode .system-notification__message { color: #d1d8e5; }
.dark-mode .system-notification__close,
body.dark-mode .system-notification__close { color: #cbd5e1; }

@keyframes system-notification-in {
    from { opacity: 0; transform: translate3d(24px, -4px, 0) scale(.97); }
    to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes system-notification-out {
    from { opacity: 1; transform: translate3d(0, 0, 0); }
    to { opacity: 0; transform: translate3d(24px, 0, 0); }
}

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

@media (max-width: 575.98px) {
    .system-notification-region { top: 10px; right: 10px; width: calc(100vw - 20px); }
    .system-notification { grid-template-columns: 36px minmax(0, 1fr) 26px; padding: 12px 10px 12px 12px; }
    .system-notification__icon { width: 34px; height: 34px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .system-notification,
    .system-notification.is-leaving,
    .system-notification__progress::after { animation: none; }
}
