.app-toasts {
    --layer-toast: 90;
    position: fixed;
    z-index: var(--layer-toast);
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
    width: min(25rem, 100vw);
    max-height: 100vh;
    max-height: 100dvh;
    padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 24px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    background: transparent;
    pointer-events: none;
    font-family: inherit;
}

.app-toast {
    --toast-start: #2563c9;
    --toast-end: #1d4ed8;
    --toast-ink: #fff;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 0;
    min-height: 48px;
    padding: 8px 10px 8px 14px;
    border: 1px solid #ffffff26;
    border-radius: 6px;
    background: linear-gradient(110deg, var(--toast-start), var(--toast-end));
    color: var(--toast-ink);
    box-shadow: 0 5px 12px #0f172a24;
    pointer-events: auto;
    animation: app-toast-enter .18s ease-out;
}

.app-toast--success { --toast-start: #087957; --toast-end: #047052; }
.app-toast--error { --toast-start: #c6253d; --toast-end: #b52267; }
.app-toast--warning { --toast-start: #fbbf24; --toast-end: #f59e0b; --toast-ink: #422006; }

.app-toast__icon {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--toast-end);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}
.app-toast--warning .app-toast__icon {
    clip-path: polygon(50% 0, 100% 94%, 0 94%);
    border-radius: 0;
    padding-top: 4px;
    color: #713f12;
    font-size: 12px;
}

.app-toast__content { min-width: 0; flex: 1; }
.app-toast__title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.app-toast__message {
    margin: 0;
    color: inherit;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.app-toast__close {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 30px;
    height: 32px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}
.app-toast__close:hover { background: #ffffff26; }
.app-toast__close:focus-visible { outline: 2px solid currentColor; outline-offset: -3px; }

@keyframes app-toast-enter {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 480px) {
    .app-toasts { width: 100%; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 24px 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .app-toast { animation: none; }
    .app-toast__close { transition: none; }
}
@media print { .app-toasts { display: none; } }
