/*
 * CENTER CRM 0.11.4 — global floating toast notifications.
 * Server flash messages stay above every CRM layer, can be closed manually,
 * and disappear automatically after 5 seconds.
 */

.center-toast-stack {
    position: fixed !important;
    left: max(18px, env(safe-area-inset-left)) !important;
    bottom: max(18px, env(safe-area-inset-bottom)) !important;
    z-index: 2147483000 !important;
    display: flex !important;
    flex-direction: column-reverse !important;
    align-items: flex-start !important;
    gap: 10px !important;
    width: min(440px, calc(100vw - 36px)) !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
    isolation: isolate;
}

html body .center-toast-stack .center-flash-notice[data-flash-toast] {
    --toast-accent: #5da9ff;
    --toast-accent-rgb: 93, 169, 255;
    position: relative !important;
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) 30px !important;
    align-items: center !important;
    gap: 11px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 13px 12px 14px 13px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    border: 1px solid rgba(var(--toast-accent-rgb), .46) !important;
    border-radius: 15px !important;
    background:
        linear-gradient(135deg, rgba(var(--toast-accent-rgb), .11), transparent 48%),
        rgba(25, 25, 25, .96) !important;
    color: #f5f5f5 !important;
    box-shadow:
        0 18px 46px rgba(0, 0, 0, .48),
        0 0 0 1px rgba(255, 255, 255, .025) inset,
        0 0 28px rgba(var(--toast-accent-rgb), .08) !important;
    backdrop-filter: blur(16px) saturate(1.1);
    -webkit-backdrop-filter: blur(16px) saturate(1.1);
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    pointer-events: auto !important;
    transform-origin: left bottom;
    animation: center-toast-enter .24s cubic-bezier(.2, .8, .2, 1) both;
}

html body .center-toast-stack .flash-success {
    --toast-accent: #55b978;
    --toast-accent-rgb: 85, 185, 120;
}

html body .center-toast-stack .flash-warning {
    --toast-accent: #f6c543;
    --toast-accent-rgb: 246, 197, 67;
}

html body .center-toast-stack .flash-danger {
    --toast-accent: #f06a67;
    --toast-accent-rgb: 240, 106, 103;
}

html body .center-toast-stack .flash-info {
    --toast-accent: #5da9ff;
    --toast-accent-rgb: 93, 169, 255;
}

.center-flash-icon {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid rgba(var(--toast-accent-rgb), .38);
    border-radius: 10px;
    background: rgba(var(--toast-accent-rgb), .13);
    color: var(--toast-accent);
    font-size: 17px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 0 18px rgba(var(--toast-accent-rgb), .09) inset;
}

.flash-success .center-flash-icon::before { content: "✓"; }
.flash-warning .center-flash-icon::before { content: "!"; }
.flash-danger .center-flash-icon::before { content: "×"; }
.flash-info .center-flash-icon::before { content: "i"; font-family: Georgia, serif; font-style: italic; }

.center-flash-content {
    min-width: 0;
    color: #f3f3f3;
    font-size: .91rem;
    font-weight: 650;
    line-height: 1.48;
}

.center-flash-close {
    display: grid;
    width: 30px;
    height: 30px;
    margin: 0;
    padding: 0;
    place-items: center;
    align-self: start;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 9px;
    background: rgba(255, 255, 255, .035);
    color: #a8a8a8;
    cursor: pointer;
    transition: color .16s ease, border-color .16s ease, background .16s ease, transform .16s ease;
}

.center-flash-close svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.center-flash-close:hover,
.center-flash-close:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(var(--toast-accent-rgb), .38);
    background: rgba(var(--toast-accent-rgb), .1);
    color: #fff;
    outline: none;
}

.center-flash-progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--toast-accent), rgba(var(--toast-accent-rgb), .35));
    transform-origin: left center;
    animation: center-toast-progress 5s linear forwards;
}

.center-flash-notice.is-leaving {
    pointer-events: none !important;
    animation: center-toast-leave .22s ease forwards !important;
}

.center-flash-notice.is-leaving .center-flash-progress {
    animation-play-state: paused;
}

.center-flash-notice:not([data-flash-toast]) {
    width: fit-content;
    max-width: min(720px, calc(100vw - 48px));
}

@keyframes center-toast-enter {
    from { opacity: 0; transform: translate3d(-18px, 12px, 0) scale(.97); }
    to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes center-toast-leave {
    from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
    to { opacity: 0; transform: translate3d(-18px, 8px, 0) scale(.97); }
}

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

@media (max-width: 620px) {
    .center-toast-stack {
        right: max(12px, env(safe-area-inset-right)) !important;
        left: max(12px, env(safe-area-inset-left)) !important;
        bottom: max(12px, env(safe-area-inset-bottom)) !important;
        width: auto !important;
    }

    html body .center-toast-stack .center-flash-notice[data-flash-toast] {
        grid-template-columns: 30px minmax(0, 1fr) 28px !important;
        gap: 9px !important;
        padding: 11px 10px 12px 11px !important;
        border-radius: 13px !important;
    }

    .center-flash-icon { width: 29px; height: 29px; border-radius: 9px; }
    .center-flash-content { font-size: .85rem; }
    .center-flash-close { width: 28px; height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    html body .center-toast-stack .center-flash-notice[data-flash-toast],
    .center-flash-notice.is-leaving {
        animation-duration: .01ms !important;
    }
}

@media print {
    .center-toast-stack { display: none !important; }
}

/* CENTER CRM 0.12.65 — chat navigation error toast hardening. */
html body .center-toast-stack .center-chat-navigation-toast[data-flash-toast] .center-flash-content {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
}

html body .center-toast-stack .center-chat-navigation-toast[data-flash-toast] .center-flash-close {
    flex: 0 0 auto !important;
}

@media (max-width: 620px) {
    html body .center-toast-stack .center-chat-navigation-toast[data-flash-toast] {
        width: 100% !important;
    }
}
