.app-toast {
    position: fixed;
    z-index: 100000;
    display: flex;
    visibility: hidden;
    align-items: flex-start;
    gap: 10px;
    box-sizing: border-box;
    width: 380px;
    max-width: calc(100% - 32px);
    padding: 12px 10px 14px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    transition: opacity 0.24s ease, transform 0.24s ease, visibility 0.24s ease;
}

.app-toast--visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.app-toast--top-right {
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    bottom: auto;
    left: auto;
    transform: translateY(-10px);
}

.app-toast--top-left {
    top: max(16px, env(safe-area-inset-top));
    right: auto;
    bottom: auto;
    left: max(16px, env(safe-area-inset-left));
    transform: translateY(-10px);
}

.app-toast--top-center {
    top: max(16px, env(safe-area-inset-top));
    right: auto;
    bottom: auto;
    left: 50%;
    transform: translate(-50%, -10px);
}

.app-toast--bottom-right {
    top: auto;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    left: auto;
    transform: translateY(10px);
}

.app-toast--bottom-left {
    top: auto;
    right: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    left: max(16px, env(safe-area-inset-left));
    transform: translateY(10px);
}

.app-toast--bottom-center {
    top: auto;
    right: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translate(-50%, 10px);
}

.app-toast--visible.app-toast--top-right,
.app-toast--visible.app-toast--top-left,
.app-toast--visible.app-toast--bottom-right,
.app-toast--visible.app-toast--bottom-left {
    transform: translateY(0);
}

.app-toast--visible.app-toast--top-center,
.app-toast--visible.app-toast--bottom-center {
    transform: translate(-50%, 0);
}

.app-toast--success {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.app-toast--warning {
    background: #fffbeb;
    border-color: #fde68a;
}

.app-toast--danger {
    background: #fef2f2;
    border-color: #fecaca;
}

.app-toast--info {
    background: #f0f9ff;
    border-color: #bae6fd;
}

.app-toast__icon {
    display: flex;
    flex: 0 0 20px;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin: 0;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
}

.app-toast__icon::before {
    content: "i";
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-size: 12px;
    line-height: 1;
}

.app-toast--success .app-toast__icon {
    background: #dcfce7;
    color: #15803d;
}

.app-toast--success .app-toast__icon::before {
    content: "\2713";
    font-family: inherit;
    font-style: normal;
    font-size: 11px;
}

.app-toast--warning .app-toast__icon {
    background: #fef3c7;
    color: #b45309;
}

.app-toast--warning .app-toast__icon::before,
.app-toast--danger .app-toast__icon::before {
    content: "!";
    font-family: inherit;
    font-style: normal;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.app-toast--danger .app-toast__icon {
    background: #fee2e2;
    color: #dc2626;
}

.app-toast--info .app-toast__icon {
    background: #e0f2fe;
    color: #0369a1;
}

.app-toast__message {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: #1e293b;
    overflow-wrap: anywhere;
}

.app-toast__close {
    display: flex;
    flex: 0 0 20px;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
}

.app-toast__close svg {
    display: block;
    width: 12px;
    height: 12px;
}

.app-toast__close:hover {
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
}

.app-toast__progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    transform: scaleX(0);
    transform-origin: left center;
    background: #94a3b8;
    pointer-events: none;
}

.app-toast--success .app-toast__progress {
    background: #16a34a;
}

.app-toast--warning .app-toast__progress {
    background: #d97706;
}

.app-toast--danger .app-toast__progress {
    background: #dc2626;
}

.app-toast--info .app-toast__progress {
    background: #0284c7;
}

.app-toast--sticky .app-toast__progress {
    display: none;
}

.app-toast--visible:not(.app-toast--sticky) .app-toast__progress {
    animation: app-toast-progress var(--toast-delay, 4s) linear forwards;
}

.app-toast.is-paused .app-toast__progress {
    animation-play-state: paused;
}

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

@media (max-width: 768px) {
    .app-toast {
        width: auto;
        max-width: none;
    }

    .app-toast--top-right,
    .app-toast--top-left,
    .app-toast--top-center {
        top: max(12px, env(safe-area-inset-top));
        right: max(12px, env(safe-area-inset-right));
        left: max(12px, env(safe-area-inset-left));
        transform: translateY(-10px);
    }

    .app-toast--bottom-right,
    .app-toast--bottom-left,
    .app-toast--bottom-center {
        top: auto;
        right: max(12px, env(safe-area-inset-right));
        bottom: max(12px, env(safe-area-inset-bottom));
        left: max(12px, env(safe-area-inset-left));
        transform: translateY(10px);
    }

    .app-toast--visible.app-toast--top-right,
    .app-toast--visible.app-toast--top-left,
    .app-toast--visible.app-toast--top-center,
    .app-toast--visible.app-toast--bottom-right,
    .app-toast--visible.app-toast--bottom-left,
    .app-toast--visible.app-toast--bottom-center {
        transform: translateY(0);
    }
}
