.server-flash-stack {
    position: fixed;
    top: 70px;
    right: 18px;
    z-index: 10080;
    display: grid;
    gap: 10px;
    width: min(390px, calc(100vw - 24px));
    pointer-events: none;
}

.server-flash {
    --flash-accent: #2563eb;
    --flash-soft: #dbeafe;
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    gap: 10px;
    align-items: center;
    overflow: hidden;
    padding: 12px 10px 12px 12px;
    border: 1px solid color-mix(in srgb, var(--flash-accent) 24%, transparent);
    border-left: 4px solid var(--flash-accent);
    border-radius: 13px;
    background: var(--surface-1, var(--hz-surface, #fff));
    color: var(--text-color, #17231d);
    box-shadow: 0 16px 42px rgba(15, 23, 42, .2);
    pointer-events: auto;
    animation: serverFlashIn .2s ease-out;
}

.server-flash[data-level="success"] { --flash-accent: #16a34a; --flash-soft: #dcfce7; }
.server-flash[data-level="warning"] { --flash-accent: #d97706; --flash-soft: #fef3c7; }
.server-flash[data-level="error"] { --flash-accent: #dc2626; --flash-soft: #fee2e2; }

.server-flash > .server-flash-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--flash-soft);
    color: var(--flash-accent);
    font-size: 1rem;
}

.server-flash-copy {
    min-width: 0;
}

.server-flash-copy strong,
.server-flash-copy span {
    display: block;
}

.server-flash-copy strong {
    margin-bottom: 1px;
    font-size: .78rem;
}

.server-flash-copy span {
    color: var(--muted-color, var(--hz-muted, #64748b));
    font-size: .73rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.server-flash-close {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted-color, var(--hz-muted, #64748b));
    cursor: pointer;
}

.server-flash-close:hover,
.server-flash-close:focus-visible {
    background: color-mix(in srgb, var(--flash-accent) 10%, transparent);
    color: var(--flash-accent);
}

.server-flash-timer {
    position: absolute;
    inset: auto 0 0;
    height: 2px;
    transform-origin: left center;
    background: var(--flash-accent);
    animation: serverFlashTimer var(--flash-duration, 7000ms) linear forwards;
}

.server-flash.is-paused .server-flash-timer {
    animation-play-state: paused;
}

.server-flash.is-leaving {
    opacity: 0;
    transform: translateX(24px);
    transition: opacity .18s ease, transform .18s ease;
}

body.dark-mode .server-flash,
:root[data-theme="dark"] .server-flash {
    background: #111827;
    color: #e5edf7;
    border-color: color-mix(in srgb, var(--flash-accent) 38%, #334155);
}

body.dark-mode .server-flash-copy span,
:root[data-theme="dark"] .server-flash-copy span {
    color: #a8b6ca;
}

@keyframes serverFlashIn {
    from { opacity: 0; transform: translateX(28px); }
    to { opacity: 1; transform: none; }
}

@keyframes serverFlashTimer {
    to { transform: scaleX(0); }
}

@media (max-width: 767.98px) {
    .server-flash-stack {
        top: 52px;
        right: 8px;
        width: calc(100vw - 16px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .server-flash { animation: none; }
    .server-flash-timer { animation: none; transform: none; }
    .server-flash.is-leaving { transition: none; }
}
