/* Inline notices remain readable when JavaScript is unavailable. */
.toast-region {
    margin: 1rem;
}

.toast-stack {
    display: grid;
    gap: 0.75rem;
}

.toast-region--enhanced {
    position: fixed;
    top: 5rem;
    right: 1rem;
    z-index: 900;
    width: min(24rem, calc(100% - 2rem));
    max-height: calc(100vh - 6rem);
    max-height: calc(100dvh - 6rem);
    margin: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    pointer-events: none;
}

.toast {
    --toast-accent: #2563eb;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid #d1d5db;
    border-left: 4px solid var(--toast-accent);
    border-radius: 0.5rem;
    background: #fff;
    color: #374151;
    box-shadow: 0 4px 12px rgb(0 0 0 / 12%);
    pointer-events: auto;
}

.toast--success { --toast-accent: #15803d; }
.toast--error { --toast-accent: #dc2626; }
.toast--warning { --toast-accent: #a16207; }

.toast-icon {
    flex-shrink: 0;
    margin-top: 0.125rem;
    color: var(--toast-accent);
}

.toast-content {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.toast-label {
    margin: 0 0 0.25rem;
    color: #111827;
    font-size: 0.875rem;
    font-weight: 600;
}

.toast-message {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.toast-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    margin: -0.25rem -0.25rem 0 0;
    border-radius: 0.375rem;
    color: #4b5563;
    cursor: pointer;
}

.toast-close[hidden] { display: none; }
.toast-close:hover { background: #f3f4f6; }
.toast-close:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.dark .toast {
    --toast-accent: #93c5fd;
    background: #374151;
    border-color: #4b5563;
    border-left-color: var(--toast-accent);
    color: #e5e7eb;
    box-shadow: 0 4px 12px rgb(0 0 0 / 30%);
}

.dark .toast--success { --toast-accent: #86efac; }
.dark .toast--error { --toast-accent: #fca5a5; }
.dark .toast--warning { --toast-accent: #fde047; }
.dark .toast-label { color: #f9fafb; }
.dark .toast-close { color: #d1d5db; }
.dark .toast-close:hover { background: #4b5563; }
.dark .toast-close:focus-visible { outline-color: #93c5fd; }

.toast-region--enhanced .toast {
    animation: toast-enter 160ms ease-out;
}

@keyframes toast-enter {
    from { opacity: 0; transform: translateY(-0.5rem); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .toast-region--enhanced .toast { animation: none; }
}
